<template>
  <div class="login" v-if="!showcz">
    <h2>玄武加拿大牛牛机器人</h2>
    <el-row :gutter="20">
      <el-col :span="12" :offset="6">
        <div class="grid-content ep-bg-purple" />
        <el-form label-width="auto" label-position="Right" size="large" >
          <el-form-item label="吾圈账号" @keydown.enter="handleEnter">
            <el-input v-model="userName" />
          </el-form-item>
          <el-form-item label="吾圈密码" @keydown.enter="handleEnter">
            <el-input v-model="password" type="password" @keydown.enter="handleEnter"/>
          </el-form-item>
          <el-form-item label="吾圈服务器id">
            <el-input v-model="serverId" @keydown.enter="handleEnter"/>
          </el-form-item>
          <el-form-item label="卡密">
            <el-input v-model="kakaka" @keydown.enter="handleEnter"/>
          </el-form-item>
          <el-form-item label="接口测速">
            <el-radio-group v-model="kjapi">
              <el-radio :label="1">主要网络 {{ kjtime1 }}ms</el-radio>
              <el-radio :label="2">备用网络 {{ kjtime2 }}ms</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="onSubmit" :disabled="denglogin" style="width: 100%;" @keydown.enter.prevent>登录</el-button>
          </el-form-item>
        </el-form>
      </el-col>

    </el-row>
  </div>
  <div class="contex"  v-if="showcz">
    <el-button-group>
      <el-button type="primary" style="margin-bottom: 5px;" @click="startadmin" @keydown.enter.prevent><el-icon>
          <CircleCheck />
        </el-icon>{{ isstart ? "系统停止" : '系统启动' }}</el-button>
      <el-button type="primary" @click="baocunnum" @keydown.enter.prevent><el-icon>
          <Setting />
        </el-icon>保存设置</el-button>
    </el-button-group>
    <el-descriptions class="margin-top" :column="6" :size="size" border>
      <el-descriptions-item>
        <template #label>
          <div class="cell-item">
            <el-icon>
              <Platform />
            </el-icon>
            状态
          </div>
        </template>
        {{ isstart ? '启动' : '停止' }}
      </el-descriptions-item>
      <el-descriptions-item>
        <template #label>
          <div class="cell-item">
            <el-icon>
              <CreditCard />
            </el-icon>
            账单积分
          </div>
        </template>
        {{ userzjf }}
      </el-descriptions-item>
      <el-descriptions-item>
        <template #label>
          <div class="cell-item">
            <el-icon>
              <User />
            </el-icon>
            账单人数
          </div>
        </template>
        {{ usernumjl.filter(item=>item.iszhenren =='真').length }}
      </el-descriptions-item>
      <el-descriptions-item>
        <template #label>
          <div class="cell-item">
            <el-icon :style="iconStyle">
              <tickets />
            </el-icon>
            当前下注期号
          </div>
        </template>
        {{ jndkjnextissue }}
      </el-descriptions-item>
      <el-descriptions-item>
        <template #label>
          <div class="cell-item">
            <el-icon>
              <Checked />
            </el-icon>
            距离开奖
          </div>
        </template>
        {{ jndkjDtime }}
      </el-descriptions-item>
      <el-descriptions-item>
        <template #label>
          <div class="cell-item">
            <el-icon>
              <Link />
            </el-icon>
            下注状态
          </div>
        </template>
        {{ isfp ? '封盘中' : '下注中' }}
      </el-descriptions-item>
    </el-descriptions>
    <el-row>
      <el-col span="12">
        <el-descriptions class="margin-top" :column="3" :size="size" border>
          <el-descriptions-item>
            <template #label>
              <div class="cell-item">
                <el-icon>
                  <CreditCard />
                </el-icon>
                上期盈亏
              </div>
            </template>
            {{ userzjf2 }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template #label>
              <div class="cell-item">
                <el-icon>
                  <User />
                </el-icon>
                今日盈亏
              </div>
            </template>
            {{ userzjf3 }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template #label>
              <div class="cell-item">
                <el-icon>
                  <User />
                </el-icon>
                软件到期时间
              </div>
            </template>
            {{ ruanjianDtime }}
          </el-descriptions-item>
        </el-descriptions>
      </el-col>
    </el-row>
    <el-tabs tab-position="top" class="demo-tabs" type="border-card">
      <el-tab-pane label="基础设置">
        <el-row ::gutter="20">
          <el-col :span="12">
            <el-card>
              <template #header>
                <div class="card-header">
                  <span style="font-size: small;">{{ xuanzhong }}</span>
                </div>
              </template>
              <el-table :data="groupList" ref="singleTableRef" highlight-current-row
                @current-change="handleSelectionChange">
                <el-table-column property="groupID" label="群ID" width="120" />
                <el-table-column property="name" label="群名称" />
              </el-table>
            </el-card>
          </el-col>
          <el-col :span="12">
            <el-card>
              <template #header>
                <div class="card-header">
                  <span style="font-size: small;">手动开奖(卡奖|测试可用)</span>
                </div>
              </template>
              <div>
                <el-form label-width="auto" label-position="Right" size="large">
                  <el-form-item label="开奖期号">
                    <el-input v-model="zhuangnum" @keydown.enter="handleEnter"/>
                  </el-form-item>
                </el-form>
              </div>
              <div>
                <el-form label-width="auto" label-position="Right" size="large">
                  <el-form-item label="开奖号码(用,隔开)">
                    <el-input v-model="kjnum" @keydown.enter="handleEnter"/>
                  </el-form-item>
                  <el-form-item>
                    <el-button type="primary" @click="onKjy" style="width: 100%;" @keydown.enter.prevent>提交开奖</el-button>
                  </el-form-item>
                </el-form>
              </div>
            </el-card>
          </el-col>
        </el-row>
      </el-tab-pane>
      <el-tab-pane label="用户账单详情">

        <el-table :data="filterTableData3"  table-layout="auto" border max-height="650" :summary-method="getSummaries" show-summary
          :default-sort="{ prop: 'create_at', order: 'descending' }" :row-class-name="tableRowClassName">
          <el-table-column prop="nick">
            <template #header>
              <el-input v-model="search3" size="small" placeholder="搜索用户" @keydown.enter="handleEnter"/>
            </template>
          </el-table-column>
          <el-table-column prop="userid" label="用户id" />
          <el-table-column prop="num" label="用户账单余额" />
          <el-table-column prop="djnum" label="用户冻结金额" />
          <el-table-column prop="iszhenren" label="是否真人" />
          <el-table-column prop="lashou" label="拉手名称" />
          <el-table-column label="操作">
            <template #default="scope">
              <el-button type="primary" size="small" @click="bianji(scope.$index, scope.row)" @keydown.enter.prevent>
                编辑
              </el-button>
            </template>
          </el-table-column>
        </el-table >
        <el-dialog v-model="dialogFormVisibleusernum" title="修改用户">
          <el-form :model="formusernum">
            <el-form-item label="用户名">
              <el-input v-model="formusernum.nick" autocomplete="off" @keydown.enter="handleEnter"/>
            </el-form-item>
            <el-form-item label="用户id">
              <el-input v-model="formusernum.userid" autocomplete="off" disabled @keydown.enter="handleEnter"/>
            </el-form-item>
            <el-form-item label="用户积分">
              <el-input v-model="formusernum.num" autocomplete="off" @keydown.enter="handleEnter"/>
            </el-form-item>
            <el-form-item label="用户冻结积分">
              <el-input v-model="formusernum.djnum" autocomplete="off" @keydown.enter="handleEnter"/>
            </el-form-item>
            <el-form-item label="是否真人">
              <el-radio-group v-model="formusernum.iszhenren">
                <el-radio-button label="真" />
                <el-radio-button label="假" />
              </el-radio-group>
            </el-form-item>
            <el-form-item label="拉手名称">
              <el-input v-model="formusernum.lashou" autocomplete="off" @keydown.enter="handleEnter"/>
            </el-form-item>
            <el-form-item label="用户" v-if='xiugaiusernum'>
              <el-input v-model="xiugaiusernumindex" autocomplete="off" @keydown.enter="handleEnter"/>
            </el-form-item>
          </el-form>
          <template #footer>
            <span class="dialog-footer">
              <el-button type="primary" @click="baocunbianji" @keydown.enter.prevent>
                保存
              </el-button>
            </span>
          </template>
        </el-dialog>
      </el-tab-pane>
      <el-tab-pane label="游戏设置">
        <el-form label-width="auto" label-position="Right" size="default" :inline="true">
          <el-form-item label="下注最低限额">
            <el-input v-model="num.xenum" @keydown.enter="handleEnter"/>
          </el-form-item>
          <el-form-item label="下注最高限额">
            <el-input v-model="num.maxnum" @keydown.enter="handleEnter"/>
          </el-form-item>
        </el-form>
        <el-form label-width="auto" label-position="Right" size="default" :inline="true">
          <el-form-item label="对子赔率">
            <el-input v-model="num.dzpl" @keydown.enter="handleEnter"/>
          </el-form-item>
          <el-form-item label="金牛赔率">
            <el-input v-model="num.jnpl" @keydown.enter="handleEnter"/>
          </el-form-item>
          <el-form-item label="牛牛赔率">
            <el-input v-model="num.niupl" @keydown.enter="handleEnter"/>
          </el-form-item>
          <el-form-item label="牛九赔率">
            <el-input v-model="num.n9pl" @keydown.enter="handleEnter"/>
          </el-form-item>
          <el-form-item label="牛八赔率">
            <el-input v-model="num.n8pl" @keydown.enter="handleEnter"/>
          </el-form-item>
          <el-form-item label="牛七赔率">
            <el-input v-model="num.n7pl" @keydown.enter="handleEnter"/>
          </el-form-item>
          <el-form-item label="牛六赔率">
            <el-input v-model="num.n6pl" @keydown.enter="handleEnter"/>
          </el-form-item>
          <el-form-item label="牛五赔率">
            <el-input v-model="num.n5pl" @keydown.enter="handleEnter"/>
          </el-form-item>
          <el-form-item label="牛四赔率">
            <el-input v-model="num.n4pl" @keydown.enter="handleEnter"/>
          </el-form-item>
          <el-form-item label="牛三赔率">
            <el-input v-model="num.n3pl" @keydown.enter="handleEnter"/>
          </el-form-item>
          <el-form-item label="牛二赔率">
            <el-input v-model="num.n2pl" @keydown.enter="handleEnter"/>
          </el-form-item>
          <el-form-item label="牛一赔率">
            <el-input v-model="num.n1pl" @keydown.enter="handleEnter"/>
          </el-form-item>
          <el-form-item label="抽水百分比">
            <el-input v-model="num.cslv" @keydown.enter="handleEnter">
              <template #append>%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="流水起反">
            <el-input v-model="num.lsqf" @keydown.enter="handleEnter">
            </el-input>
          </el-form-item>
          <el-form-item label="流水反水">
            <el-input v-model="num.fslv" @keydown.enter="handleEnter">
              <template #append>%</template>
            </el-input>
          </el-form-item>
        </el-form>
      </el-tab-pane>
      <el-tab-pane label="信息设置">
        <el-tabs class="demo2-tabs" type="card" v-model="demotebs1">
          <el-tab-pane label="停猜" name="tingcai">
            <el-row :gutter="20">
              <el-col :span="8">
                <el-form>
                  <el-form-item label="开奖前:">
                    <el-input-number v-model="num.tingcai1" size="small" />
                    <el-input v-model="num.tingcai1text" :autosize="{ minRows: 20, maxRows: 50 }" type="textarea"
                      placeholder="请输入" />
                  </el-form-item>
                </el-form>
              </el-col>
              <el-col :span="8">
                <el-form>
                  <el-form-item label="开奖前:">
                    <el-input-number v-model="num.tingcai2" size="small" />
                    <el-input v-model="num.tingcai2text" :autosize="{ minRows: 20, maxRows: 50 }" type="textarea"
                      placeholder="请输入" />
                  </el-form-item>
                </el-form>
              </el-col>
              <el-col :span="8">
                <el-form>
                  <el-form-item label="开奖前:">
                    <el-input-number v-model="num.tingcai3" size="small" />
                    <el-input v-model="num.tingcai3text" :autosize="{ minRows: 20, maxRows: 50 }" type="textarea"
                      placeholder="请输入" />
                    <span><el-text class="mx-1" type="danger">{期号}</el-text>：当前下注期号</span>
                    <span><el-text class="mx-1" type="danger">{内容核对}</el-text>：用户下注内容列表</span>
                  </el-form-item>
                </el-form>
              </el-col>
            </el-row>
          </el-tab-pane>
          <el-tab-pane label="开奖" name="kaijiang">
            <el-row :gutter="20">
              <el-col :span="8">
                <el-form label-position="top">
                  <el-form-item label="开奖前信息:">
                    <el-input v-model="num.kaij1text" :autosize="{ minRows: 20, maxRows: 50 }" type="textarea"
                      placeholder="请输入" />
                  </el-form-item>
                </el-form>
              </el-col>
              <el-col :span="8">
                <el-form label-position="top">
                  <el-form-item label="开奖信息:">
                    <el-input v-model="num.kaij2text" :autosize="{ minRows: 20, maxRows: 50 }" type="textarea"
                      placeholder="请输入" />
                    <span><el-text class="mx-1" type="danger">{期号}</el-text>：当前下注期号</span>
                    <span><el-text class="mx-1" type="danger">{开奖结果}</el-text>：开奖结果</span>
                    <span><el-text class="mx-1" type="danger">{用户中奖}</el-text>：用户中奖盈亏列表</span>
                  </el-form-item>
                </el-form>
              </el-col>
              <el-col :span="8">
                <el-form label-position="top">
                  <el-form-item label="积分列表信息:">
                    <el-input v-model="num.kaij3text" :autosize="{ minRows: 20, maxRows: 50 }" type="textarea"
                      placeholder="请输入" />
                    <span><el-text class="mx-1" type="danger">{在线人数}</el-text>：账单人数</span>
                    <span><el-text class="mx-1" type="danger">{列表总分}</el-text>：账单总积分</span>
                    <span><el-text class="mx-1" type="danger">{玩家列表}</el-text>：用户账单列表</span>
                  </el-form-item>
                </el-form>
              </el-col>
            </el-row>
          </el-tab-pane>
          <el-tab-pane label="启动" name="xitongconngi">
            <el-row :gutter="20">
              <el-col :span="8">
                <el-form label-position="top">
                  <el-form-item label="停止信息:">
                    <el-input v-model="num.tingzhitext" :autosize="{ minRows: 20, maxRows: 50 }" type="textarea"
                      placeholder="请输入" />
                  </el-form-item>
                </el-form>
              </el-col>
              <el-col :span="8">
                <el-form label-position="top">
                  <el-form-item label="启动信息:">
                    <el-input v-model="num.qidongtext" :autosize="{ minRows: 20, maxRows: 50 }" type="textarea"
                      placeholder="请输入" />
                  </el-form-item>
                </el-form>
              </el-col>
            </el-row>
          </el-tab-pane>
          <el-tab-pane label="广告" name="advlist">
            <el-button @click="dialogTableVisible = true" style="margin-bottom: 5px;" @keydown.enter.prevent>新增广告文本</el-button>
            <el-table :data="adv" table-layout="auto" max-height="700">
              <el-table-column prop="text" label="发送文本" />
              <el-table-column prop="fasongnum" label="发送时间" />
              <el-table-column label="操作">
                <template #default="scope">
                  <el-button @click="sendadv(scope.$index, scope.row)" @keydown.enter.prevent>
                    手动发送
                  </el-button>
                  <el-button @click="readv(scope.$index, scope.row)" @keydown.enter.prevent>
                    删除
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
            <el-dialog v-model="dialogTableVisible" title="新增广告文本">
              <el-form>
                <el-form-item label="开奖前发送">
                  <el-input-number v-model="fasongnum" />
                </el-form-item>
                <el-from-item label="广告文本">
                  <el-input v-model="textarea2" :autosize="{ minRows: 20, maxRows: 25 }" type="textarea"
                    placeholder="请输入" />
                </el-from-item>
              </el-form>
              <el-button @click="addadv" style="margin-top: 5px;" type="primary" @keydown.enter.prevent>确定新增</el-button>
            </el-dialog>
          </el-tab-pane>
          <el-tab-pane label="其他设置" name="quitcongif">
            <el-row ::gutter="20">
              <el-col :span="12">
                <el-card>
                  <template #header>
                    <div class="card-header">
                      <span style="font-size: small;">附加关键词字</span>
                    </div>
                  </template>
                    <el-form label-width="auto" label-position="Right" size="large">
                      <el-form-item label="查数据关键字">
                        <el-input v-model="num.csj" @keydown.enter="handleEnter"/>
                      </el-form-item>
                      <el-form-item label="查走势关键字">
                        <el-input v-model="num.czs" @keydown.enter="handleEnter"/>
                      </el-form-item>
                      <el-form-item label="查流水关键字">
                        <el-input v-model="num.cls" @keydown.enter="handleEnter"/>
                      </el-form-item>
                      <el-form-item label="自反水关键字">
                        <el-input v-model="num.cfs" @keydown.enter="handleEnter"/>
                      </el-form-item>
                      <el-form-item label="查余额关键字">
                        <el-input v-model="num.cye" @keydown.enter="handleEnter"/>
                      </el-form-item>
                    </el-form>
                    <span><el-text class="mx-1" type="danger">留空等于不启用关键字</el-text></span>
                </el-card>
              </el-col>
              <el-col :span="12">
                <el-card>
                  <template #header>
                    <div class="card-header">
                      <span style="font-size: small;">假人查回审核</span>
                    </div>
                  </template>
                    <el-form label-width="auto" label-position="Right" size="large">
                      <el-form-item label="">
                        <el-checkbox v-model="num.jiarenisshenhe" label="假人自动审核" />
                      </el-form-item>
                      <el-form-item label="查延时审核">
                        <el-input v-model="num.cys" @keydown.enter="handleEnter"/>
                      </el-form-item>
                      <el-form-item label="回延时审核">
                        <el-input v-model="num.hys" @keydown.enter="handleEnter"/>
                      </el-form-item>
                    </el-form>
                    <span><el-text class="mx-1" type="danger">查回延时设置秒数以上,且不会超设置60秒以上</el-text></span>
                </el-card>
              </el-col>
            </el-row>
          </el-tab-pane>
        </el-tabs>
      </el-tab-pane>
      <el-tab-pane label="未结算下注详细">
        <el-button @click="reAll" @keydown.enter.prevent>删除全部</el-button>
        <el-table :data="xiazhumingxicup" table-layout="auto" border max-height="650" :summary-method="getSummaries3"  show-summary
           :row-class-name="tableRowClassName">
          <el-table-column prop="nick">
                <template #header>
                  <el-input v-model="searxiazhuusername" size="small" placeholder="搜索用户" @keydown.enter="handleEnter"/>
                </template>
              </el-table-column>
          <el-table-column prop="userid" label="用户id" />
          <el-table-column prop="issue" label="下注期号" />
          <el-table-column prop="xz" label="下注明细" />
          <el-table-column prop="ls" label="下注流水" />
          <el-table-column prop="iszhenren" label="是否真人" />
          <el-table-column prop="create_at" sortable label="最后下注时间" />
          <el-table-column label="操作">
            <template #default="scope">
              <el-button size="small" @click="shanchuxiazhu(scope.$index, scope.row)" @keydown.enter.prevent>
                删除
              </el-button>
              <el-button size="small" @click="bianjiuserxiazhu(scope.$index, scope.row)" @keydown.enter.prevent>
                修改
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-dialog v-model="dialogFormVisibleuserxiazhu" title="用户下注修改">
          <el-form :model="formuserxiazhu2">
            <el-form-item label="用户名称">
              <el-input v-model="formuserxiazhu2.nick" autocomplete="off" @keydown.enter="handleEnter"/>
            </el-form-item>
            <el-form-item label="用户ID">
              <el-input v-model="formuserxiazhu2.userid" autocomplete="off" disabled @keydown.enter="handleEnter"/>
            </el-form-item>
            <el-form-item label="下注期号">
              <el-input v-model="formuserxiazhu2.issue" autocomplete="off" disabled @keydown.enter="handleEnter"/>
            </el-form-item>
            <el-form-item label="下注明细">
              <el-input v-model="formuserxiazhu2.xz" autocomplete="off" @keydown.enter="handleEnter"/>
            </el-form-item>
            <el-form-item label="下注流水" v-if='xiugaiusernum'>
              <el-input v-model="formuserxiazhu2.ls" autocomplete="off" @keydown.enter="handleEnter"/>
            </el-form-item>
          </el-form>
          <template #footer>
            <span class="dialog-footer">
              <el-button type="primary" @click="baocunbianji4" @keydown.enter.prevent>
                确定修改
              </el-button>
            </span>
          </template>
        </el-dialog>
      </el-tab-pane>
      <el-tab-pane label="开奖结果">
        <el-row :gutter="20">
          <el-col :span="12">
            <el-table :data="jndkjdata" size="small" class="jndkj1" border>
              <el-table-column label="开奖期号" width="90" align="center">
                <template #default="scope">
                  <div>
                    <span>{{ scope.row.LotNumber }}</span>
                  </div>
                </template>
              </el-table-column>
              <el-table-column label="开奖" width="130" align="center">
                <template #default="scope">
                  <div>
                    <span>{{ scope.row.LotResultNo }}</span>
                  </div>
                </template>
              </el-table-column>
              <el-table-column label="A注" width="80" align="center">
                <template #default="scope">
                  <div>
                    <span :class="niuniu(scope.row.c1)">{{ scope.row.c1 }}</span>
                  </div>
                </template>
              </el-table-column>
              <el-table-column label="B注" width="80" align="center">
                <template #default="scope">
                  <div>
                    <span :class="niuniu(scope.row.c2)">{{ scope.row.c2 }}</span>
                  </div>
                </template>
              </el-table-column>
              <el-table-column label="结果" width="80" align="center">
                <template #default="scope">
                  <div>
                    <span :class="syclass(scope.row.sy)"> {{ scope.row.sy }} </span>
                  </div>
                </template>
              </el-table-column>
            </el-table>
          </el-col>
        </el-row>
      </el-tab-pane>
      <el-tab-pane>
        <template #label>
          <el-badge :value="filterTableDatauserch.length" class="item">
            <span class="custom-tabs-label">
              <span>查回审核</span>
            </span>
          </el-badge>
        </template>
        <el-row :gutter="20">
          <el-col :span="24">
            <el-table :data="filterTableDatauserch" max-height="600" border :row-class-name="tableRowClassName2">
              <el-table-column prop="id" label="序号"/>
              <el-table-column prop="nick">
                <template #header>
                  <el-input v-model="searchusername" size="small" placeholder="搜索用户" @keydown.enter="handleEnter"/>
                </template>
              </el-table-column>
              <el-table-column prop="userid" label="用户id" />
              <el-table-column prop="type" label="类型" />
              <el-table-column prop="num" label="金额" />
              <el-table-column prop="iszhenren" label="是否真人" />
              <el-table-column prop="lashou" label="拉手名称" />
              <el-table-column label="操作">
                <template #default="scope">
                  <el-button size="small" @click="bianji2(scope.$index, scope.row)" @keydown.enter.prevent>
                    审核
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
            <el-dialog v-model="dialogFormVisibleuserch" title="用户查回审核">
              <el-form :model="formusernum2">
                <el-form-item label="用户名称">
                  <el-input v-model="formusernum2.nick" autocomplete="off" @keydown.enter="handleEnter" />
                </el-form-item>
                <el-form-item label="用户ID">
                  <el-input v-model="formusernum2.userid" autocomplete="off" disabled @keydown.enter="handleEnter" />
                </el-form-item>
                <el-form-item label="查回积分">
                  <el-input v-model="formusernum2.num" autocomplete="off" @keydown.enter="handleEnter" />
                </el-form-item>
                <el-form-item label="查回类型">
                  <el-input v-model="formusernum2.type" autocomplete="off" disabled @keydown.enter="handleEnter"/>
                </el-form-item>
                <el-form-item label="是否真人" >
                  <el-radio-group v-model="formusernum2.iszhenren">
                    <el-radio-button label="真" />
                    <el-radio-button label="假" />
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="拉手名称" >
                  <el-input v-model="formusernum2.lashou" autocomplete="off" @keydown.enter="handleEnter"/>
                </el-form-item>
                <el-form-item label="下标" v-if='xiugaiusernum'>
                  <el-input v-model="xiugaiusernumindex2" autocomplete="off" @keydown.enter="handleEnter"/>
                </el-form-item>
                <el-form-item label="id" v-if='xiugaiusernum'>
                  <el-input v-model="formusernum2.id" autocomplete="off" @keydown.enter="handleEnter"/>
                </el-form-item>
              </el-form>
              <template #footer>
                <span class="dialog-footer">
                  <el-button  @click="baocunbianji3" @keydown.enter.prevent>
                    拒绝
                  </el-button>
                  <el-button type="primary" @click="baocunbianji2" @keydown.enter.prevent>
                    同意
                  </el-button>
                </span>
              </template>
            </el-dialog>
          </el-col>
        </el-row>
      </el-tab-pane>
      <el-tab-pane label="游戏助手">
        <el-row>
          <el-col span="24">
            <el-form inline="true" size='default'>
              <el-form-item label="日期">
                <el-date-picker v-model="tongjidatevalue" type="daterange" range-separator="至" start-placeholder="开始时间"
                  end-placeholder="结束时间" style="width: 220px;" />
              </el-form-item>
              <el-form-item>
                <el-button-group>
                  <el-button @click="tongjizr" @keydown.enter.prevent>昨天</el-button>
                  <el-button @click="tongjijinri" @keydown.enter.prevent>今天</el-button>
                </el-button-group>
              </el-form-item>
              <el-form-item label="用户名称">
                <el-input v-model="tongjiuserid" style="width: 120px" placeholder="请输入用户名" @keydown.enter="handleEnter" />
              </el-form-item>
              <el-form-item label="真/假">
                <el-radio-group v-model="radiozhenren" size="small">
                  <el-radio-button label="真" />
                  <el-radio-button label="假" />
                </el-radio-group>
              </el-form-item>
              <el-form-item>
                <el-button-group>
                  <el-button @click="tongjiall" >统计</el-button>
                  <el-button @click="shujudaochu" >数据导出</el-button>
                  <el-button @click="qingchushuju" type="danger">清除30天前数据</el-button>
                </el-button-group>
              </el-form-item>
            </el-form>
          </el-col>
        </el-row>
        <el-tabs v-model="tabactiveName" type="card" class="demo-tabs">
          <el-tab-pane label="查回统计" name="tongjich">
            <el-row :gutter="0">
              <el-form inline="true">
                <el-form-item label="今日上分总数">
                  <el-input v-model="tongjichjinrishangfen" disabled style="width: 100px;" />
                </el-form-item>
                <el-form-item label="今日回分总数">
                  <el-input v-model="tongjichjinrihuifen" disabled style="width: 100px;" />
                </el-form-item>
                <el-form-item label="今日福利总数">
                  <el-input v-model="tongjichjinrifuli" disabled style="width: 100px;" />
                </el-form-item>
                <el-form-item label="剩余积分">
                  <el-input v-model="tongjichsyfen" disabled style="width: 100px;" />
                </el-form-item>
                <el-form-item>
                  <el-radio-group v-model="tongjichtype">
                    <el-radio-button label="上分" value="上分" />
                    <el-radio-button label="下分" value="下分" />
                    <el-radio-button label="福利" value="福利" />
                    <el-radio-button label="全部" value="全部" />
                  </el-radio-group>
                </el-form-item>
                <el-form-item>
                  <el-radio-group v-model="tongjichstuas">
                    <el-radio-button label="同意" value="同意" />
                    <el-radio-button label="拒绝" value="拒绝" />
                    <el-radio-button label="全部" value="全部" />
                  </el-radio-group>
                </el-form-item>
              </el-form>
            </el-row>
            <el-pagination
                @current-change="handleCurrentChange2"
                :current-page="currentPage2"
                :page-size="pageSize2"
                layout="total, prev, pager, next, jumper"
                :total="tongjitablech.length"
                background
                />
            <el-table :data="tongjitablech.slice((currentPage2-1)*pageSize2, currentPage2*pageSize2)" border style="width: 100%" max-height="550"
              :default-sort="{ prop: 'create_at', order: 'descending' }">
              <el-table-column prop="create_at" label="审核时间" />
              <el-table-column prop="nick" label="昵称" />
              <el-table-column prop="userid" label="用户id" />
              <el-table-column prop="type" label="类型" />
              <el-table-column prop="num" label="分数" />
              <el-table-column prop="status" label="审核结果" />
            </el-table>
          </el-tab-pane>
          <el-tab-pane label="玩家猜猜明细" name="tongjicaicai">
            <el-pagination
                @current-change="handleCurrentChange"
                :current-page="currentPage"
                :page-size="pageSize"
                layout="total, prev, pager, next, jumper"
                :total="tongjiuserzhongjiang.length"
                background
                />
            <el-table  :data="tongjiuserzhongjiang.slice((currentPage-1)*pageSize, currentPage*pageSize)" border style="width: 100%;font-size: 12px;" :summary-method="getSummaries2"  show-summary
              max-height="500" :default-sort="{ prop: 'create_at', order: 'descending' }">
              <el-table-column prop="issue" label="期号" />
              <el-table-column prop="kj" label="开奖" />
              <el-table-column prop="c1" label="A注" />
              <el-table-column prop="c2" label="B注" />
              <el-table-column prop="sy" label="结果" />
              <el-table-column prop="nick" label="昵称" />
              <el-table-column prop="userid" label="用户id" />
              <el-table-column prop="xz" label="猜猜内容" />
              <el-table-column prop="ls" label="本局流水" />
              <el-table-column prop="zjls" label="输赢分数" />
              <el-table-column prop="xnum" label="剩余积分" />
              <el-table-column prop="create_at" label="时间" />
            </el-table>
              
          </el-tab-pane>
          <el-tab-pane label="回水计算" name="tongjihuishui">
            <el-row :gutter="20">
              <el-col span="8">
                <p><span>今日竞猜总人数:<el-text class="mx-1" type="danger">{{ jinrijingcairenshu }}</el-text></span></p>
                <p><span>赢总人数/分数：<el-text class="mx-1" type="danger">{{ yingzongrenshu }}/{{ yingzongfenshu
                      }}</el-text></span></p>
                <p><span>输总人数/分数：<el-text class="mx-1" type="danger">{{ shuzongrenshu }}/{{ shuzongfenshu
                      }}</el-text></span></p>
              </el-col>
              <el-col span="8">
                <p><span>今日竞猜总分数:<el-text class="mx-1" type="danger">{{ jinrijingcaifenshu }}</el-text></span></p>
                <p><span>今日竞猜总盈亏:<el-text class="mx-1" type="danger">{{ jinrijingcaizongyk }}</el-text></span></p>
                <p><span>自助反水总人数:<el-text class="mx-1" type="danger">{{ zizhufanshuirenshu }}</el-text></span></p>
              </el-col>
              <el-col span="8">
                <p><span>福利总分数:<el-text class="mx-1" type="danger">{{ fulizongfenshu }}</el-text></span></p>
                <p><span>实际总盈亏:<el-text class="mx-1" type="danger">{{ shijiyingkui }}</el-text></span></p>
                <el-button type="primary" @click="shoudongjisuanfanshui" :disabled="sdjisuanwanc" @keydown.enter.prevent>手动计算反水挂账单</el-button>
              </el-col>
            </el-row>
            <el-table :data="tongjihuishuijisuan" border style="width: 100%" max-height="400"
              :default-sort="{ prop: 'create_at', order: 'descending' }">
              <el-table-column prop="nick" label="昵称" />
              <el-table-column prop="userid" label="用户id" />
              <el-table-column prop="ls" label="流水" />
              <el-table-column prop="issuenum" label="期数" />
              <el-table-column prop="yk" label="盈亏" />
              <el-table-column prop="fulif" label="福利分" />
              <el-table-column prop="sjyk" label="实际盈亏" />
              <el-table-column prop="zfs" label="总反水" />
              <el-table-column prop="zzfs" label="自助反水" />
              <el-table-column prop="sdfs" label="手动反水" />
              <el-table-column prop="syfs" label="剩余反水" />
            </el-table>
          </el-tab-pane>
          <el-tab-pane label="分数统计" name="tongjifenshu">
            <el-pagination
                @current-change="handleCurrentChange3"
                :current-page="currentPage3"
                :page-size="pageSize3"
                layout="total, prev, pager, next, jumper"
                :total="tongjizhuang.length"
                background
                />
            <el-table  :data="tongjizhuang.slice((currentPage3-1)*pageSize3, currentPage3*pageSize3)" border style="width: 100%" show-summary max-height="600"
              :default-sort="{ prop: 'create_at', order: 'descending' }">
              <el-table-column prop="LotNumber" label="期号" />
              <el-table-column prop="LotResultNo" label="开奖" width="180" />
              <el-table-column prop="c1" label="A注" />
              <el-table-column prop="c2" label="B注" />
              <el-table-column prop="sy" label="结果" />
              <el-table-column prop="zyl" label="真人分数" />
              <el-table-column prop="jyl" label="假人分数" />
              <el-table-column prop="type" label="备注" />
              <el-table-column prop="create_at" label="时间" width="200" />
            </el-table>
          </el-tab-pane>
          <el-tab-pane label="反水记录" name="tongjifanshui">
            <el-pagination
                @current-change="handleCurrentChange4"
                :current-page="currentPage4"
                :page-size="pageSize4"
                layout="total, prev, pager, next, jumper"
                :total="tongjiuserfs.length"
                background
                />
            <el-table  :data="tongjiuserfs.slice((currentPage4-1)*pageSize4, currentPage4*pageSize4)" border style="width: 100%" max-height="600" show-summary
              :default-sort="{ prop: 'create_at', order: 'descending' }">
              <el-table-column prop="nick" label="昵称" />
              <el-table-column prop="userid" label="用户id" />
              <el-table-column prop="fs" label="反水积分" />
              <el-table-column prop="type" label="备注" />
              <el-table-column prop="create_at" label="时间" width="200" />
            </el-table>
          </el-tab-pane>
          <el-tab-pane label="账变记录" name="tongjizhangbian">
            <el-pagination
                @current-change="handleCurrentChange5"
                :current-page="currentPage5"
                :page-size="pageSize5"
                layout="total, prev, pager, next, jumper"
                :total="tongjizhangbian.length"
                background
                />
            <el-table :data="tongjizhangbian.slice((currentPage5-1)*pageSize5, currentPage5*pageSize5)" border style="width: 100%" max-height="600"
              :default-sort="{ prop: 'create_at', order: 'descending' }">
              <el-table-column prop="nick" label="昵称" />
              <el-table-column prop="userid" label="用户id" />
              <el-table-column prop="ynum" label="原积分" />
              <el-table-column prop="bnum" label="账变积分" />
              <el-table-column prop="xnum" label="现积分" />
              <el-table-column prop="type" label="账变原因" />
              <el-table-column prop="create_at" label="时间" width="200" />
            </el-table>
          </el-tab-pane>
          <el-tab-pane label="操作记录" name="caozuojl">
            <div v-if="!isjinrudadmin" style="text-align: center;">
              <el-form inline="true" size='default'>
                <el-form-item label="密码">
                  <el-input
                    v-model="useradminpsw"
                    type="password"
                    show-password
                    @keydown.enter="handleEnter"
                  />
                
                </el-form-item>
                <el-form-item >
                  <el-button @click="jinruadmin" @keydown.enter.prevent>进入</el-button>
                </el-form-item>
              </el-form>
            </div>
            <div v-if="isjinrudadmin">
              <el-form inline="true" size='default'>
                <el-form-item label="日期">
                    <el-date-picker
                        v-model="caozuojldate"
                        type="date"
                        :size="size"
                    />
                    <el-button @click="chakancaozuo" @keydown.enter.prevent>查询操作记录</el-button>
                </el-form-item>
                <el-form-item label="新密码">
                  <el-input
                    v-model="newadminpsw"
                    type="password"
                    show-password
                    @keydown.enter="handleEnter"
                  />
                </el-form-item>
                <el-form-item >
                  <el-button @click="xiugaiadminpsw"  type="primary" @keydown.enter.prevent>修改管理密码</el-button>
                </el-form-item>
              </el-form>
              <el-pagination
                @current-change="handleCurrentChange6"
                :current-page="currentPage6"
                :page-size="pageSize6"
                layout="total, prev, pager, next, jumper"
                :total="tongjicaozuo.length"
                background
                />
              <el-table :data="tongjicaozuo.slice((currentPage6-1)*pageSize6, currentPage6*pageSize6)" border style="width: 100%" max-height="600"
                :default-sort="{ prop: 'infodate', order: 'descending' }">
                <el-table-column prop="infodate" label="操作时间"/>
                <el-table-column prop="conter" label="操作内容" />
              </el-table>
            </div>
          </el-tab-pane>
        </el-tabs>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import axios from 'axios'
import { ElMessage } from 'element-plus'
import TencentCloudChat from '@tencentcloud/chat';
import TIMUploadPlugin from 'tim-upload-plugin';
import moment from 'moment';
import CryptoJS from 'crypto-js';
import { openDB } from 'idb';
import mp3 from './assets/y1897.mp3'
import Worker from 'worker-loader!./worker.js'
import html2canvas from 'html2canvas'
import * as XLSX from 'xlsx'
export default {
  name: 'App',
  data() {
    return {
      sizeForm: [],
      lashoutabledata:[],
      wanjiatabledata:[],
      userName: '',
      serverId: '',
      password: '',
      xiazhutuo: '',
      accid: '',
      xiugaiusernum: false,
      imappid: 0,
      token: '',
      isjinrudadmin:false,
      kjapi:1,
      kjtime1:0,
      useradminpsw:'',
      kjtime2:0,
      xiugaiusernumindex: 0,
      idbadvindex: 1,
      peilv: {},
      newadminpsw:'',
      tongjichtype: '全部',
      tongjichstuas: '全部',
      chat: null,
      sdjisuanwanc:false,
      dialogFormVisibleuserch:false,
      showcz: false,
      caozuojldate:moment().format('YYYY-MM-DD'),
      tongjidatevalue: [moment().format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')],
      lashoudate:moment().format('YYYY-MM-DD'),
      kj: [],
      tongjicaozuo:[],
      tabactiveName: 'tongjich',
      formusernum: {},
      formusernum2:{},
      xiugaiusernumindex2:0,
      kjtm: 0,
      fasongnum: 0,
      num: {
        xenum: 10,
        maxnum: 1000000,
        dzpl: 13,
        jnpl: 12,
        niupl: 10,
        n9pl: 9,
        n8pl: 8,
        n7pl: 7,
        n6pl: 6,
        n5pl: 5,
        n4pl: 4,
        n3pl: 3,
        n2pl: 2,
        n1pl: 1,
        tingcai1: 120,
        tingcai2: 81,
        tingcai3: 80,
        tingcai2text: '',
        tingcai1text: '',
        tingcai3text: '',
        kaij3text: '',
        kaij2text: '',
        kaij1text: '',
        qidongtext: '',
        tingzhitext: '',
        fslv: 5,
        cslv: 3,
        lsqf: 100,
        csj:'1',
        czs:'2',
        cls:'3',
        cfs:'4',
        cye:'5',
        jiarenisshenhe:true,
        cys:15,
        hys:15,
      },
      adminpsw:'',
      isstart: false,
      starttext: '启动系统',
      kjnum: '',
      nextdate: '',
      ruanjianDtime:'',
      disabled: true,
      groupList: [],
      xuanGroupList: [],
      xuanzhong: '请选择群',
      dateVule: '',
      value1: true,
      Crypto: CryptoJS.enc.Utf8.parse("666888\0\0\0\0\0\0\0\0\0\0"),
      xiazhu: [],// 下注信息
      xiazhumingxi: [],
      zhuangnum: 1,
      fasongfp: false,
      userzhongjiang: [],
      userchjl: [],
      usernumjl: [],
      userch: [],
      kakaka: '',
      userzjls: [],
      dTime: 0,
      userxiazhujl: [],
      search: '',
      search2: '',
      search3: '',
      adv: [],
      dialogTableVisible: false,
      textarea2: '',
      searchissue: '',
      dbName: 'my-database',
      idb: null,
      idbindex: 1,
      userxiazhumingxi: [],
      cachexiazhu: [],
      audio: new Audio(mp3),
      dialogFormVisibleusernum: false,
      demozhongjiang: [],
      isfp: true,
      lskaijiang: [],
      idblskjindex: 0,
      jndkjdata: [],
      jndkjnewissue: 0,
      jndkjnextissue: 0,
      jndkjDtime: 0,
      worker: new Worker(),
      imgfileurl: '',
      idbhuiindex: 0,
      radiozhenren:'真',
      denglogin:false,
      zhangbianjl: [],
      demotebs1: 'tingcai',
      tongjichjinrishangfen: 0,
      tongjichjinrihuifen: 0,
      tongjichjinrifuli: 0,
      tongjichsyfen: 0,
      tongjiuserch: [],
      tongjiuserzhongjiang: [],
      tongjiuserfs: [],
      tongjizhangbian: [],
      tongjizhuang: [],
      tongjiuserid: '',
      tongjihuishuijisuan: [],
      jinrijingcairenshu: 0,
      yingzongrenshu: 0,
      yingzongfenshu: 0,
      shuzongrenshu: 0,
      shuzongfenshu: 0,
      jinrijingcaifenshu: 0,
      jinrijingcaizongyk: 0,
      zizhufanshuirenshu: 0,
      fulizongfenshu: 0,
      shijiyingkui: 0,
      kakacreate_at:'',
      file:null,
      searchusername:'',
      searxiazhuusername:'',
      formuserxiazhu2:{},
      dialogFormVisibleuserxiazhu:false,
      demolashounick:'',
      admininfo:[],
      currentPage: 1,
      pageSize: 10,
      currentPage2: 1,
      pageSize2: 10,
      currentPage3: 1,
      pageSize3: 10,
      currentPage4: 1,
      pageSize4: 10,
      currentPage5: 1,
      pageSize5: 10,
      currentPage6: 1,
      pageSize6: 10,
      currentPage7: 1,
      pageSize7: 10,
      idbzhangbianid:0,
      idbzhongjiangid:0,
      idbusernumjlid:0,
    }
  },
  components: {

  },
  updated() {

  },
  computed: {
    // 计算属性
    tongjitablech() {
      let res = this.tongjiuserch
      if (this.tongjichtype == '上分') {
        res = res.filter(item => item.type == '查')
      }
      if (this.tongjichtype == '下分') {
        res = res.filter(item => item.type == '回')
      }
      if (this.tongjichtype == '福利') {
        res = res.filter(item => item.type == '福利')
      }
      if (this.tongjichstuas == '同意') {
        res = res.filter(item => item.status == '完成')
      }
      if (this.tongjichstuas == '拒绝') {
        res = res.filter(item => item.status == '拒绝')
      }
      return res
    },
    userzjf() {
      let zhang  = this.usernumjl.filter(item=>item.iszhenren == '真')
      let zhenghejf = zhang.reduce((accumulator, current) => parseInt(accumulator) + parseInt(current.num), 0)
      return zhenghejf
    },
    userzjf2() {
      let synum = 0
      if(this.lskaijiang.length!=0){
        synum = this.lskaijiang[this.lskaijiang.length-1].zyl
      }
      return synum
    },
    userzjf3() {
      let newDay = moment().format('YYYY-MM-DD')
      let zhenghejf = this.lskaijiang.filter(item=>moment(item.create_at).format('YYYY-MM-DD') === newDay)
      let synum = 0
      zhenghejf.forEach(list=>{
        synum = synum + parseInt(list.zyl)
      })
      return synum
    },
    xiazhumingxicup() {
      let uuuuu = [...this.usernumjl]
      uuuuu.sort((a, b) => b.num - a.num)
      uuuuu.sort((a,b)=>{
        let aContainsChar = a.iszhenren=='真'
        let bContainsChar = b.iszhenren=='真'
        if (aContainsChar && !bContainsChar) return -1;
        if (!aContainsChar && bContainsChar) return 1;
        return 0;
      })
      let redata = []
      uuuuu.forEach(item=>{
        let xiazz = this.xiazhumingxi.filter(list=>list.userid==item.userid)
        if(xiazz.length!=0){
          redata.push(xiazz[0])
        }
      })
      console.log(redata)
      return redata.filter(item => !this.searxiazhuusername || item.nick.toLowerCase().includes(this.searxiazhuusername.toLowerCase()))
    },
    filterTableData3() {
      let uuuuu = [...this.usernumjl]
      uuuuu.sort((a, b) => b.num - a.num)
      uuuuu.sort((a,b)=>{
        let aContainsChar = a.iszhenren=='真'
        let bContainsChar = b.iszhenren=='真'
        if (aContainsChar && !bContainsChar) return -1;
        if (!aContainsChar && bContainsChar) return 1;
        return 0;
      })
    
      return uuuuu.filter(item => !this.search3 || item.nick.toLowerCase().includes(this.search3.toLowerCase()))
    },
    filterTableDatauserch(){
      let chehui = this.userch.filter(item=>item.iszhenren == '真')
      return chehui.filter(item => !this.searchusername || item.nick.toLowerCase().includes(this.searchusername.toLowerCase()))
    },
    filterTableData() {
      let fgheimingd = this.xiazhutuo.slice('|')
      let rearr = []
      if (fgheimingd[0] !== '' || !fgheimingd[0]) {
        // 有黑名单
        rearr = this.userxiazhujl.filter(list => !fgheimingd.includes(list.nick))
      } else {
        // 没有不处理
        rearr = this.userxiazhujl
      }
      let arrd = rearr.filter(item => !this.search || item.userid.toLowerCase().includes(this.search.toLowerCase()))
      arrd = arrd.filter(item => !this.searchissue || item.issue.includes(this.searchissue))
      return arrd
    },
    filterTableData2() {
      return this.userchjl.filter(item => !this.search2 || item.userid.toLowerCase().includes(this.search2.toLowerCase()))
    },
    chnum() {
      return this.userch.length
    },
  },
  created() {
    axios.get('https://api.kkaakj.com/open/history?game=Canadian')
      .then(response => {
        if(response.data.resultCode){
          let endTime = performance.now(); // 请求完成的时间
          console.log(`请求完成时间: ${endTime}`);
          console.log(`请求耗时: ${endTime - startTime}毫秒`);
          this.kjtime1 = parseInt(`${endTime - startTime}`)
        }else{
          this.kjtime1 = '超时'
        }
      })
      .catch(error => {
        console.error('请求失败:', error);
        this.kjtime1 = '超时'
      });

      axios.get('https://api.ts28.com.cn/getjndkj2')
      .then(() => {
          let endTime = performance.now(); // 请求完成的时间
          console.log(`请求完成时间: ${endTime}`);
          console.log(`请求耗时: ${endTime - startTime}毫秒`);
          this.kjtime2 = parseInt(`${endTime - startTime}`)
      })
      .catch(error => {
        console.error('请求失败:', error);
        this.kjtime2 = '超时'
      });
    const startTime = performance.now(); // 请求开始的时间
    this.idb = openDB(this.dbName, 2, {
      upgrade(db) {
        db.createObjectStore('my-store');
        db.createObjectStore('num');
        db.createObjectStore('usernum');
        db.createObjectStore('userch');
        db.createObjectStore('zhongjiang');
        db.createObjectStore('userxiazhu');
        db.createObjectStore('adv');
        db.createObjectStore('cachexiazhu');
        db.createObjectStore('kaijshezhi');
        db.createObjectStore('zhangbian');
        db.createObjectStore('admininfo');
      },
    })
    this.getItems('num').then(res => {
      if (res.length != 0) {
        this.num = res[0]
        this.password = res[1].password
        this.serverId = res[1].serverId
        this.userName = res[1].userName
        this.kakaka = res[1].kakaka
        this.adminpsw = res[1].adminpsw
      } else {
        this.password = ""
        this.serverId =""
        this.userName = ""
        this.kakaka =""
        this.adminpsw = btoa('123456')
        this.num = {
          cslv: 3,
          dzpl: 13,
          fslv: 5,
          jnpl: 12,
          kaij1text: "开奖中...",
          kaij2text: "{期号}期：\n{开奖结果}\n----------------------\n----本期中奖玩家----\n{用户中奖}",
          kaij3text: "在线人数 {在线人数} - 总分 {列表总分}\n===============\n{玩家列表}\n===============\n账单之前下注无效！\n现在可以下注...",
          lsqf: 100,
          maxnum: 1000000,
          n1pl: 1,
          n2pl: 2,
          n3pl: 3,
          n4pl: 4,
          n5pl: 5,
          n6pl: 6,
          n7pl: 7,
          n8pl: 8,
          n9pl: 9,
          niupl: 10,
          qidongtext: "系统开启",
          tingcai1: 105,
          tingcai1text: "---距离封盘还有60秒---",
          tingcai2: 45,
          tingcai2text: "----------------\n已截止投注，不改不退\n以核对账单为准，无须纠结积分\n----------------",
          tingcai3: 44,
          tingcai3text: "{期号}期下注核对：\n--------------------\n{内容核对}\n--------------------",
          tingzhitext: "系统关闭",
          xenum: 10,
          csj:'1',
          czs:'2',
          cls:'3',
          cfs:'4',
          cye:'5',
          jiarenisshenhe:true,
          cys:15,
          hys:15,
        }
      }
      if (res[1]) {
        this.xiazhutuo = res[1].data
      } else {
        this.xiazhutuo = ''
      }
    })
    this.getItems('usernum').then(res => {
      if (res.length != 0) {
        this.usernumjl = res
        this.idbusernumjlid = this.usernumjl[this.usernumjl.length-1].id+1
      } else {
        this.usernumjl = []
        this.idbusernumjlid=0
      }
    })
    this.getItems('admininfo').then(res => {
      if (res.length != 0) {
        this.admininfo = res
      } else {
        this.admininfo = []
      }
    })
    this.getItems('userch').then(res => {
      if (res.length != 0) {
        this.userchjl = res
        this.idbhuiindex = this.userchjl[this.userchjl.length-1].id+1
      } else {
        this.userchjl = []
        this.idbhuiindex = 0
      }
    })
    this.getItems('zhongjiang').then(res => {
      if (res.length != 0) {
        this.userxiazhujl = res
        this.idbzhongjiangid = this.userxiazhujl[this.userxiazhujl.length-1].id+1
      } else {
        this.userxiazhujl = []
        this.idbzhongjiangid=0
      }
    })
    this.getItems('zhangbian').then(res => {
      if (res.length != 0) {
        this.zhangbianjl = res
        this.idbzhangbianid = this.zhangbianjl[this.zhangbianjl.length-1].id+1
      } else {
        this.zhangbianjl = []
        this.idbzhangbianid= 0
      }
    })
    this.getItems('userxiazhu').then(res => {
      if (res.length != 0) {
        this.userxiazhumingxi = res
      } else {
        this.userxiazhumingxi = []
      }
    })
    this.getItems('adv').then(res => {
      if (res.length != 0) {
        this.adv = res
        this.idbadvindex = res[res.length - 1].id + 1
      } else {
        this.adv = []
        this.idbadvindex = 1
      }
    })
    this.getItems('cachexiazhu').then(res => {
      if (res.length != 0) {
        this.cachexiazhu = res
      } else {
        this.cachexiazhu = []
      }
    })
    this.getItems('kaijshezhi').then(res => {
      if (res.length != 0) {
        this.lskaijiang = res
      } else {
        this.lskaijiang = []
      }
    })
    this.getxiazhull()
    
  },
  watch: {
    jndkjnextissue(newV, old) {
      console.log(newV)
      if (old !== 0 && this.isstart) {
        // 真开奖
        // 处理开奖
        this.onKj(1, this.jndkjdata[0])
        setTimeout(()=>{
          this.exportTableToImage()
        },500)
      }else{
        setTimeout(()=>{
          this.exportTableToImage()
        },500)
      }
    },
    tongjichstuas() {
      console.log('ddd')
    },
    tongjichtype() {
      console.log('ddd')
    },
    xiazhu(newV, old) {
      console.log(newV)
      console.log(old)
    },
    groupList(newV, old) {
      console.log(newV)
      console.log(old)
    },
    usernumjl(newV, old) {
      console.log(newV)
      console.log(old)
    },
    xuanGroupList(newV, old) {
      this.xuanzhong = '选择了:' + newV.name
      console.log(old)
      this.disabled = false
    },
    nextdate(newV) {
      let thisTime = moment(new Date())
      let fenpan = moment(newV).format("YYYY-MM-DD")
      let fengpandate = moment(fenpan + ' 21:25:00').format('YYYY-MM-DD HH:mm:ss')
      this.dTime = moment(fengpandate).diff(thisTime, 'seconds')
    },
  },
  mounted() {
  },
  methods: {
    handleCurrentChange(val) {
      this.currentPage = val;
    },
    handleCurrentChange2(val) {
      this.currentPage2 = val;
    },
    handleCurrentChange3(val) {
      this.currentPage3 = val;
    },
    handleCurrentChange4(val) {
      this.currentPage4 = val;
    },
    handleCurrentChange5(val) {
      this.currentPage5 = val;
    },
    handleCurrentChange6(val) {
      this.currentPage6 = val;
    },
    tableRowClassName({ row }){
      if(row.iszhenren == '假'){
        return 'custom-row-class'
      }
      return ''
    },
    tableRowClassName2({ row }){
      if(row.type == '回'){
        return 'custom-row-class'
      }
      return ''
    },
    handleEnter(event){
      event.preventDefault(); 
    },
    getSummaries2({ columns, data }){
      const sums = []
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = '合计'
          return;
        }else if(column.property == 'ls'){
          sums[index] = data.reduce((accumulator, current) => parseInt(accumulator) + parseInt(current.ls), 0)
        }else if(column.property == 'zjls'){
          sums[index] = data.reduce((accumulator, current) => parseInt(accumulator) + parseInt(current.zjls), 0)
        } else{
          sums[index]  = ''
        }
        
      })
      return sums
    },
    getSummaries({ columns, data }){
      const sums = []
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = '合计'
          return;
        }else if(column.property == 'num'){
          let data2 = data.filter(item=>item.iszhenren =='真')
          sums[index] = data2.reduce((accumulator, current) => parseInt(accumulator) + parseInt(current.num), 0)
        }else{
          sums[index]  = ''
        }
        
      })
      return sums
    },
    getSummaries3({ columns, data }){
      const sums = []
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = '合计'
          return;
        }else if(column.property == 'ls'){
          sums[index] = data.reduce((accumulator, current) => parseInt(accumulator) + parseInt(current.ls), 0)
        }else{
          sums[index]  = ''
        }
        
      })
      return sums
    },
    xiugaiadminpsw(){
      this.newadminpsw = this.newadminpsw.trim()
      if(this.newadminpsw!=''){
        this.adminpsw = btoa(this.newadminpsw)
        ElMessage({
            message: '修改密码成功',
            type: 'success',
        })
        this.isjinrudadmin = false
        let data = {
          password: this.password,
          serverId: this.serverId,
          userName: this.userName,
          kakaka:this.kakaka,
          adminpsw:this.adminpsw
        }
      this.updateItem('num', JSON.parse(JSON.stringify(data)), 2)
      this.useradminpsw = ''
      this.newadminpsw = ''
      }else{
        ElMessage({
          message: '修改错误，密码不能为空',
          type: 'error',
        })
      }
    },
    jinruadmin(){
      console.log(this.adminpsw)
      if(btoa(this.useradminpsw) == this.adminpsw){
        // 密码正确
        this.isjinrudadmin = true
      }else{
        // 密码错误
        ElMessage({
          message: '密码错误',
          type: 'error',
        })

      }
    },
    xiugainick(userid,nick,iszhenren){
      this.userxiazhujl.filter(item=>item.userid === userid).forEach(list=>{
        list.nick = nick
        this.updateItem('zhongjiang',JSON.parse(JSON.stringify(list)),list.id)
      })
      this.userchjl.filter(item=>item.userid === userid).forEach(list=>{
        list.nick = nick
        list.iszhenren = iszhenren
        this.updateItem('userch',JSON.parse(JSON.stringify(list)),list.id)
      })
      this.cachexiazhu.filter(item=>item.userid === userid).forEach(list=>{
        list.nick = nick
        this.updateItem('cachexiazhu',JSON.parse(JSON.stringify(list)),list.id)
      })
      this.zhangbianjl.filter(item=>item.userid === userid).forEach(list=>{
        list.nick = nick
        this.updateItem('zhangbian',JSON.parse(JSON.stringify(list)),list.id)
      })
      this.xiazhu.filter(item=>item.userid === userid).forEach(list=>{
        list.nick = nick
        list.iszhenren = iszhenren
        this.updateItem('my-store',JSON.parse(JSON.stringify(list)),list.id)
      })
      this.xiazhumingxi.filter(item=>item.userid === userid).forEach(list=>{
        list.nick = nick
        list.iszhenren = iszhenren
      })
      this.userch.filter(item=>item.userid === userid).forEach(list=>{
        list.nick = nick
        list.iszhenren = iszhenren
        if(iszhenren=='假'){
          list.sendou = 30
        }else{
          list.sendou = -1
        }
      })
    },
    lashoushujudaochu(){
      let fenpan = moment(this.lashoudate).format("YYYY-MM-DD")
      let tabledata = [...this.lashoutabledata]
      let filename = fenpan+'拉手列表.xlsx'
      const ws = XLSX.utils.json_to_sheet(tabledata);
      const wb = XLSX.utils.book_new()
      XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
      /* generate file and send to client */
      XLSX.writeFile(wb, filename);
    },
    wanjiashujudaochu(){
      let fenpan = moment(this.lashoudate).format("YYYY-MM-DD")
      let tabledata = this.wanjiatabledata
      let filename = fenpan+this.demolashounick+'_详细数据.xlsx'
      const ws = XLSX.utils.json_to_sheet(tabledata);
      const wb = XLSX.utils.book_new();
      XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
      /* generate file and send to client */
      XLSX.writeFile(wb, filename);
    },
    rowclick(row){
      this.wanjiatabledata = row.wanjia
      this.demolashounick = row.nick
    },
    // lashoutongjiall(){
    //   let laarr = []
    //   let startDate = moment(this.lashoudate).format('YYYY-MM-DD')
    //   this.usernumjl.forEach(list=>{
    //     if(list.lashou !=""){
    //       let lashoufindex = laarr.findIndex(item=>{
    //         return item.nick == list.lashou
    //       })
    //       if(lashoufindex == -1){
    //         laarr.push({
    //           nick:list.lashou,
    //           wanjia:[],
    //           wanjials:0,
    //           wanjiasy:0
    //         })
    //       }
    //       let lashoufindex2 = laarr.findIndex(item=>{
    //         return item.nick == list.lashou
    //       })
    //       let tongjiuserzhongjiang = this.userxiazhujl.filter(item => {
    //         return moment(item.create_at).isBetween(startDate, startDate, 'day', '[]') && item.userid === list.userid
    //       })
    //       let ls = tongjiuserzhongjiang.reduce((acc, cur) => parseInt(acc) + parseInt(cur.ls), 0)
    //       let yk = tongjiuserzhongjiang.reduce((acc, cur) => parseInt(acc) + parseInt(cur.zjls), 0)
    //       laarr[lashoufindex2].wanjials = laarr[lashoufindex2].wanjials+ls
    //       laarr[lashoufindex2].wanjiasy = laarr[lashoufindex2].wanjiasy+yk
    //       laarr[lashoufindex2].wanjia.push({
    //         nick:list.nick,
    //         wanjialszf:ls,
    //         wanjiasyzf:yk
    //       })
    //     }
    //   })
    //   this.lashoutabledata = laarr
    // },
    getxiazhull() {
      this.getItems('my-store').then(res => {
        if (res.length != 0) {
          this.xiazhu = res
          this.idbindex = this.xiazhu[this.xiazhu.length-1].id+1
          this.usernumjl.forEach(list => {
            let issue = []
            let xiazhh = this.xiazhu.filter(item=>item.userid == list.userid)
            xiazhh.forEach(xia => {
              if (!issue.includes(xia.issue)) {
                issue.push(xia.issue)
              }
            })
            issue.forEach(iss => {
              let xiazhuren = this.xiazhu.filter(item => list.userid === item.userid && item.issue === iss)
              if(xiazhuren.length!=0){
                let ls = xiazhuren.reduce((acc, cur) => parseInt(acc) + parseInt(cur.jine), 0)
                this.xiazhumingxi.push({
                  nick: xiazhuren[0].nick,
                  userid: xiazhuren[0].userid,
                  xz: xiazhuren[0].type + ls,
                  issue: iss,
                  ls: ls,
                  date2: xiazhuren[0].date2,
                  date1: xiazhuren[0].date1,
                  iszhenren:xiazhuren[0].iszhenren,
                  create_at:xiazhuren[0].create_at,
                })
              }
            })
          })
        } else {
          this.xiazhu = []
          this.xiazhumingxi = []
          this.idbindex = 0
        }
      })
    },
    async addItem(dataname, item, id) {
      let create_at = moment().format('YYYY-MM-DD HH:mm:ss')
      let update_at = moment().format('YYYY-MM-DD HH:mm:ss')
      item.create_at = create_at
      item.update_at = update_at
      const db = await this.idb;
      const tx = db.transaction(dataname, 'readwrite');
      const store = tx.objectStore(dataname);
      store.add(item, id);
    },
    async addItem2(dataname, item) {
      const db = await this.idb;
      item.forEach(list=>{
        const tx = db.transaction(dataname, 'readwrite');
        const store = tx.objectStore(dataname);
        store.add(list, list.id);
      })
    },
    // 查询记录
    async getItems(dataname) {
      const db = await this.idb;
      const tx = db.transaction(dataname, 'readonly');
      const store = tx.objectStore(dataname);
      return store.getAll();
    },
    // 删除记录
    async deleteItem(dataname, id) {
      const db = await this.idb;
      const tx = db.transaction(dataname, 'readwrite');
      const store = tx.objectStore(dataname);
      store.delete(id);
    },
    // 更新记录
    async updateItem(dataname, updates, id) {
      let update_at = moment().format('YYYY-MM-DD HH:mm:ss')
      updates.update_at = update_at
      const db = await this.idb;
      const tx = db.transaction(dataname, 'readwrite');
      const store = tx.objectStore(dataname);
      store.put({ ...updates }, id);
    },
    // 清空存储
    async clearStore(dataname) {
      const db = await this.idb;
      const tx = db.transaction(dataname, 'readwrite');
      const store = tx.objectStore(dataname);
      store.clear();
    },
    onSubmit() {
      // 登录
      this.denglogin=true
      axios.get('https://xq.ts28.com.cn/getka?kaka='+this.kakaka).then(res=>{
        if(res.data.code == 200){
          this.kakacreate_at = res.data.data.create_at
          let creDate = moment(this.kakacreate_at).add(30,'day').format('YYYY-MM-DD HH:mm:ss')
          this.ruanjianDtime = creDate
          let thisDate = moment()
          if(!thisDate.diff(creDate,'days')>=0){
            let data = {
              password: this.password,
              serverId: this.serverId,
              userName: this.userName,
              kakaka:this.kakaka,
              adminpsw:this.adminpsw
            }
            let login = axios.create({
              baseURL: 'https://api.ts28.com.cn',

            })
            login.post('/wqlogin', data).then(res => {
              if (res.data.code == 200) {
                this.accid = res.data.data.accid
                this.toekn = res.data.data.token
                this.imappid = parseInt(res.data.data.imAppid)
                // 登录腾讯im
                let options = {
                  SDKAppID: parseInt(res.data.data.imAppid)
                }
                this.chat = TencentCloudChat.create(options);
                this.chat.registerPlugin({ 'tim-upload-plugin': TIMUploadPlugin })
                let promise = this.chat.login({ userID: res.data.data.accid, userSig: res.data.data.token });
                promise.then((imResponse) => {
                  ElMessage({
                    message: '连接服务器成功,软件到期时间：'+this.ruanjianDtime,
                    type: 'success',
                  })
                  this.denglogin=false
                  this.baocunnum()
                  this.updateItem('num', JSON.parse(JSON.stringify(data)), 2)
                  setTimeout(() => {
                    this.chat.on(TencentCloudChat.EVENT.MESSAGE_RECEIVED, this.getMsg)
                    this.chat.on(TencentCloudChat.EVENT.KICKED_OUT, this.onKickedOut);
                    this.chat.getGroupList().then(imResponses => {
                      this.groupList = imResponses.data.groupList
                      this.showcz = true
                    }).catch(imError => {
                      console.warn('getGroupList error:', imError); // 获取群组列表失败的相关信息
                    })
                  }, 1000)
                  if (imResponse.data.repeatLogin === true) {
                    // 标识账号已登录，本次登录操作为重复登录。
                    console.log(imResponse.data.errorInfo);
                    this.denglogin=false
                    this.chat.destroy()
                    this.onSubmit()
                  }
                }).catch((imError) => {
                  console.log(imError)
                  ElMessage({
                    message: '连接服务器失败请重试',
                    type: 'error',
                  })
                  this.denglogin=false
                });
              } else {
                //登录失败
                ElMessage({
                  message: res.data.msg,
                  type: 'error',
                })
              }
            }).catch(err => {
              ElMessage({
                  message: err+"请重启",
                  type: 'error',
              })
              this.denglogin=false
            })
          }else{
            ElMessage({
                message:'卡密过期',
                type: 'error',
            })
            this.denglogin=false
          }
        }else{
          ElMessage({
                message:'卡密不存在',
                type: 'error',
          })
          this.denglogin=false
        }
      })
    },
    handleSelectionChange(list) {
      this.xuanGroupList = list

    },
    onKj(type, newkjdata) {
      let pl = 1
      let wz = 'c'
      let zyl = 0
      let jyl = 0
      if (newkjdata.sy == '通杀') {
        // 通杀
        pl = 1
        wz = 'c'
      } else if (newkjdata.sy == 'A注赢') {
        // A注赢
        wz = 'a'
        switch (newkjdata.c1) {
          case '对子':
            pl = this.num.dzpl
            break
          case '金牛':
            pl = this.num.jnpl
            break
          case '牛牛':
            pl = this.num.niupl
            break
          case '牛九':
            pl = this.num.n9pl
            break
          case '牛八':
            pl = this.num.n8pl
            break
          case '牛七':
            pl = this.num.n7pl
            break
          case '牛六':
            pl = this.num.n6pl
            break
          case '牛五':
            pl = this.num.n5pl
            break
          case '牛四':
            pl = this.num.n4pl
            break
          case '牛三':
            pl = this.num.n3pl
            break
          case '牛二':
            pl = this.num.n2pl
            break
          case '牛一':
            pl = this.num.n1pl
            break
          default:
            pl = 1
        }
      } else if (newkjdata.sy == 'B注赢') {
        wz = 'b'
        switch (newkjdata.c2) {
          case '对子':
            pl = this.num.dzpl
            break
          case '金牛':
            pl = this.num.jnpl
            break
          case '牛牛':
            pl = this.num.niupl
            break
          case '牛九':
            pl = this.num.n9pl
            break
          case '牛八':
            pl = this.num.n8pl
            break
          case '牛七':
            pl = this.num.n7pl
            break
          case '牛六':
            pl = this.num.n6pl
            break
          case '牛五':
            pl = this.num.n5pl
            break
          case '牛四':
            pl = this.num.n4pl
            break
          case '牛三':
            pl = this.num.n3pl
            break
          case '牛二':
            pl = this.num.n2pl
            break
          case '牛一':
            pl = this.num.n1pl
            break
          default:
            pl = 1
        }
      }
      pl = parseInt(pl)
      let cscs = 1 - (parseInt(this.num.cslv) / 100)
      this.xiazhu.forEach(list => {
        if(list.issue == newkjdata.LotNumber){
          let useris = this.usernumjl.filter(item=>item.userid == list.userid)
          if (list.type == wz) {
            // 中
            this.userzhongjiang.push({
              nick: list.nick,
              userid: list.userid,
              issue: list.issue,
              zjls: parseInt(parseInt(list.jine) * parseInt(pl) * cscs),
              cs: parseInt(list.jine) * parseInt(pl) - parseInt(parseInt(list.jine) * parseInt(pl) * cscs),
              xz: list.xz,
              ls: list.jine
            })
            if(useris[0].iszhenren == '真'){
              zyl = zyl + (parseInt(parseInt(list.jine) * parseInt(pl) * cscs) * -1)
            }else{
              jyl = jyl+  (parseInt(parseInt(list.jine) * parseInt(pl) * cscs) * -1)
            }
          } else {
            // 不中
            this.userzhongjiang.push({
              nick: list.nick,
              userid: list.userid,
              issue: list.issue,
              zjls: parseInt(list.jine) * parseInt(pl) * -1,
              cs: 0,
              xz: list.xz,
              ls: list.jine
            })
            if(useris[0].iszhenren == '真'){
              zyl = zyl + (parseInt(list.jine) * parseInt(pl))
            }else{
              jyl = jyl +  (parseInt(list.jine) * parseInt(pl))
            }
          }
        }
      })
      // 处理 中奖
      // 处理ls取消冻结->处理中奖ls->加入中奖ls进总账单
      // 取消冻结ls(逻辑是直接等于回冻结流水)
      this.usernumjl.forEach(item => {
        let xiazhumingxixi = this.userzhongjiang.filter(xia => xia.userid == item.userid)
        // 处理中奖ls
        if (xiazhumingxixi.length != 0) {
          let hhls = xiazhumingxixi.reduce((acc, cur) => parseInt(acc) + parseInt(cur.ls), 0)
          let zjls = xiazhumingxixi.reduce((acc, cur) => parseInt(acc) + parseInt(cur.zjls), 0)
          // 处理中奖流水
            if(zjls == 0){
              console.log(xiazhumingxixi)
              console.log(this.userzhongjiang)
            }
            let zhangbianid = this.idbzhangbianid
            this.idbzhangbianid++
            let zhongjiangid = this.idbzhongjiangid
            this.idbzhongjiangid++
            let zhangbiandata = {
              nick: item.nick,
              userid: item.userid,
              id: zhangbianid,
              ynum: item.num,
              bnum: zjls,
              xnum: parseInt(item.num) + parseInt(zjls),
              type: '竞猜盈亏'
            }
            let zjpost = {
              nick: item.nick,
              userid: item.userid,
              issue: xiazhumingxixi[0].issue,
              xz: xiazhumingxixi[0].xz+hhls,
              ls: xiazhumingxixi[0].ls,
              kj: newkjdata.LotResultNo,
              c1: newkjdata.c1,
              c2: newkjdata.c2,
              sy: newkjdata.sy,
              zjls: zjls,
              ynum: item.num,
              xnum: parseInt(item.num) + parseInt(zjls),
            }
            this.demozhongjiang.push(zjpost)
            item.num = parseInt(item.num) + parseInt(zjls)
            item.djnum = parseInt(parseInt(item.djnum) - parseInt((parseInt(hhls) * this.num.dzpl)))
            // 下注记录到数据库
            // post到中奖信息库
            zjpost.id = zhongjiangid
            this.postzhongjiang2(JSON.parse(JSON.stringify(zjpost)), zhongjiangid)
            this.postzhangbian3(JSON.parse(JSON.stringify(zhangbiandata)),zhangbianid)
            // 更新用户金额
            this.putusernum2(JSON.parse(JSON.stringify(item)), item.id)
          
        }
      })
      this.getusernumAll()
      this.getzhangbian()
      this.getuserxiazhujlAll()
      this.xiazhu.forEach(item => {
        if (item.issue == newkjdata.LotNumber) {
          this.deleteItem('my-store', item.id)
        }
      })
      this.xiazhu = this.xiazhu.filter(list => list.issue != newkjdata.LotNumber)
      this.xiazhumingxi = this.xiazhumingxi.filter(list => list.issue != newkjdata.LotNumber)
      this.userzhongjiang = []
      if (type == 1) {
        // 是自动开奖
        let lskjid = this.lskaijiang.length == 0 ? 0 : this.lskaijiang[this.lskaijiang.length - 1].id + 1
        let postlskjdata = {
          CreatTime: newkjdata.CreatTime,
          LotNumber: newkjdata.LotNumber,
          LotResultNo: newkjdata.LotResultNo,
          c1: newkjdata.c1,
          c2: newkjdata.c2,
          sy: newkjdata.sy,
          zyl: zyl,
          jyl: jyl,
          id: lskjid,
          type: '系统开奖'
        }
        this.postlskj(JSON.parse(JSON.stringify(postlskjdata)), lskjid)
        if (this.xuanGroupList.length != 0) {
          this.kjfsmsg(newkjdata)
        }
      } else {
        // 是手动开奖
        let postlskjdata = {
          CreatTime: newkjdata.CreatTime,
          LotNumber: newkjdata.LotNumber,
          LotResultNo: newkjdata.LotResultNo,
          c1: newkjdata.c1,
          c2: newkjdata.c2,
          sy: newkjdata.sy,
          zyl: zyl,
          jyl:  jyl,
          id: this.idblskjindex,
          type: '手动开奖'
        }
        this.postlskj(JSON.parse(JSON.stringify(postlskjdata)), this.idblskjindex)
        this.idblskjindex++;
        if (this.xuanGroupList.length != 0) {
          this.kjfsmsg(newkjdata)
        }
      }
    },
    kjfsmsg(kjkjkj) {
      if (this.num.kaij2text != '') {
        let resmsg = this.num.kaij2text
        let kjjg = kjkjkj.LotResultNo + '\n' + 'A注：' + kjkjkj.c1 + '\n' + 'B注：' + kjkjkj.c2
        let yhyk = ''
        this.demozhongjiang = this.demozhongjiang.sort((a, b) => b.zjls - a.zjls)
        for (let index = 0; index < this.demozhongjiang.length; index++) {
          let  zhongjiangls = this.demozhongjiang[index].zjls
          if (yhyk != '') {
            yhyk = yhyk + '\n' + this.demozhongjiang[index].nick.slice(0, 2)  + '---盈亏：' + zhongjiangls
          } else {
            yhyk = this.demozhongjiang[index].nick.slice(0, 2)  + '---盈亏：' + zhongjiangls
          }
        }
        resmsg = resmsg.replace('{期号}', kjkjkj.LotNumber)
        resmsg = resmsg.replace('{开奖结果}', kjjg)
        resmsg = resmsg.replace('{用户中奖}', yhyk)
        let message = this.chat.createTextMessage({
          to: this.xuanGroupList.groupID,
          conversationType: TencentCloudChat.TYPES.CONV_GROUP,
          payload: {
            text: resmsg
          },
        })
        this.chat.sendMessage(message).then(imResponse => {
          console.log(imResponse)
          
        }).catch(err => {
          console.log(err)
        })
        this.demozhongjiang = []
      }
      if (this.num.kaij3text != '') {
        let resmsg = this.num.kaij3text
        let zonuser = this.usernumjl.reduce((accumulator, current) => parseInt(accumulator) + parseInt(current.num), 0)
        let userlist = ''
        let newuserlist = this.usernumjl.slice().sort((a, b) => b.num - a.num)
        newuserlist = newuserlist.filter(item=>parseInt(item.num)!=0)
        let zonnum = newuserlist.length
        if(newuserlist.length!=0){
          for (let index = 0; index < parseInt(newuserlist.length/2)+parseInt(newuserlist.length%2); index++) {
            userlist = userlist + newuserlist[index*2].nick.slice(0, 2) + "：" + newuserlist[index*2].num 
            if(newuserlist[index*2+1]){
              userlist = userlist +"   "+newuserlist[index*2+1].nick.slice(0, 2) + "：" + newuserlist[index*2+1].num
            }
            userlist = userlist+"\n"
          }
        }
        userlist = userlist.trim()
        resmsg = resmsg.replace('{在线人数}', zonnum)
        resmsg = resmsg.replace('{列表总分}', zonuser)
        resmsg = resmsg.replace('{玩家列表}', userlist)
        setTimeout(()=>{
          let message = this.chat.createTextMessage({
            to: this.xuanGroupList.groupID,
            conversationType: TencentCloudChat.TYPES.CONV_GROUP,
            payload: {
              text: resmsg
            },
          })
          this.chat.sendMessage(message).then(imResponse => {
            console.log(imResponse)
            this.demozhongjiang = []
          }).catch(err => {
            console.log(err)
          })
        },500)
      }
    },
    baocunnum() {
      this.updateItem('num', this.num, 1)
      ElMessage({
        message: '保存成功',
        type: 'success',
      })
    },
    getMsg(event) {
      const messageList = event.data;
      messageList.forEach((message) => {
        if (message.type === TencentCloudChat.TYPES.MSG_TEXT && this.xuanGroupList.groupID === message.to && this.isstart) {
          let msg = this.textPa(message.payload.text)
          let user = this.usernumjl.filter(item => item.userid === message.from)
          if (msg.trim() == '数据'|| (msg.trim() == this.num.csj && this.num.csj!='')) {
            // 查下注详情和流水
            let resmsg = ''
            if (user.length != 0) {
              let newDay = moment().format('YYYY-MM-DD')
              let xiazhuindex = this.xiazhumingxi.filter(item => item.userid === message.from && item.issue == this.jndkjnextissue)
              let userzhongjiang1 = this.userxiazhujl.filter(item => item.userid == message.from && moment(item.create_at).format('YYYY-MM-DD') === newDay)
              let ls = userzhongjiang1.reduce((acc, cur) => parseInt(acc) + parseInt(cur.ls), 0)
              let sy = userzhongjiang1.reduce((acc, cur) => parseInt(acc) + parseInt(cur.zjls), 0)
              resmsg = '@' + user[0].nick +" 当前积分："+user[0].num
              if (xiazhuindex.length != 0) {
                // 查询有下注
                resmsg = resmsg + "\n"+'当前盈亏：'+sy+'\n'+"当前流水："+ls+"\n"+'下注详细：' + xiazhuindex[0].xz +  '\n' + '冻结金额：' + user[0].djnum + '\n' + '剩余下注余额：' + parseInt((parseInt(user[0].num) - parseInt(user[0].djnum)) / this.num.dzpl)
              } else {
                // 无下注
                resmsg = resmsg + '\n' +'当前盈亏：'+sy+'\n'+"当前流水："+ls+"\n"+ '本期未下注' + '\n' +  '冻结金额：' + user[0].djnum + '\n' + '剩余下注余额：' + parseInt((parseInt(user[0].num) - parseInt(user[0].djnum)) / this.num.dzpl)
              }
              let rqmsg = this.chat.createTextAtMessage({
                to: message.to,
                conversationType: TencentCloudChat.TYPES.CONV_GROUP,
                payload: {
                  text: resmsg,
                  // 'denny' 'lucy' 都是 userID，而非昵称
                  atUserList: [message.from]
                },
              })
              this.chat.sendMessage(rqmsg).then(imResponse => {
                console.log(imResponse)
              }).catch(err => {
                console.log(err)
              })
            }else{
              let ls = 0
              let sy = 0
              resmsg = '@' + message.nick +" 当前积分：0"
                // 无下注
                resmsg = resmsg + '\n' +'当前盈亏：'+sy+'\n'+"当前流水："+ls+"\n"+ '本期未下注' + '\n' +  '冻结金额：0' + '\n' + '剩余下注余额：0' 
              let rqmsg = this.chat.createTextAtMessage({
                to: message.to,
                conversationType: TencentCloudChat.TYPES.CONV_GROUP,
                payload: {
                  text: resmsg,
                  // 'denny' 'lucy' 都是 userID，而非昵称
                  atUserList: [message.from]
                },
              })
              this.chat.sendMessage(rqmsg).then(imResponse => {
                console.log(imResponse)
              }).catch(err => {
                console.log(err)
              })
            }
          } else if (msg.trim() == '取消' || msg.trim() == '撤回') {
            // 取消下注
            // 判断是否封盘
            if (this.isfp) {
              let resmsg = '@' + user[0].nick + ' 取消失败,封盘后无效'
              let rqmsg = this.chat.createTextAtMessage({
                to: message.to,
                conversationType: TencentCloudChat.TYPES.CONV_GROUP,
                payload: {
                  text: resmsg,
                  // 'denny' 'lucy' 都是 userID，而非昵称
                  atUserList: [message.from]
                },
              })
              this.chat.sendMessage(rqmsg).then(imResponse => {
                console.log(imResponse)
              }).catch(err => {
                console.log(err)
              })
            } else {
              let resmsg = ''
              if (user.length != 0) {
                let qxxzuser = this.xiazhumingxi.filter(item => item.userid === message.from)
                if (qxxzuser.length != 0) {
                  let xiazhu = this.xiazhu.filter(item => item.userid === message.from)
                  xiazhu.forEach(list => {
                    this.deleteItem('my-store', list.id)
                  })
                  // 账单记录要恢复
                  this.xiazhu = this.xiazhu.filter(item => item.userid !== message.from)
                  this.xiazhumingxi = this.xiazhumingxi.filter(item => item.userid !== message.from)
                  let userzd = this.usernumjl.filter(item => item.userid === message.from)
                  //  冻结流水减去
                  userzd[0].djnum = parseInt(userzd[0].djnum) - parseInt(parseInt(qxxzuser[0].ls)*parseInt(this.num.dzpl))
                  console.log(userzd)
                  this.putusernum(userzd[0], userzd[0].id)
                  resmsg = '@' + user[0].nick + ' 取消成功'
                }else{
                  resmsg= '@' + user[0].nick +' 未下注，取消失败'
                }
                let rqmsg = this.chat.createTextAtMessage({
                  to: message.to,
                  conversationType: TencentCloudChat.TYPES.CONV_GROUP,
                  payload: {
                    text: resmsg,
                    // 'denny' 'lucy' 都是 userID，而非昵称
                    atUserList: [message.from]
                  },
                })
                this.chat.sendMessage(rqmsg).then(imResponse => {
                  console.log(imResponse)
                }).catch(err => {
                  console.log(err)
                })
              }
            }
          } else if (msg.indexOf('改') == 0) {
            // 修改下注
            // 先取消之前下注
            // 先判断是否封盘前
            if (this.isfp) {
              let resmsg = '@' + user[0].nick + ' 修改失败,封盘后无效'
              let rqmsg = this.chat.createTextAtMessage({
                to: message.to,
                conversationType: TencentCloudChat.TYPES.CONV_GROUP,
                payload: {
                  text: resmsg,
                  // 'denny' 'lucy' 都是 userID，而非昵称
                  atUserList: [message.from]
                },
              })
              this.chat.sendMessage(rqmsg).then(imResponse => {
                console.log(imResponse)
              }).catch(err => {
                console.log(err)
              })
            } else {
              if (user.length != 0) {
                let newmsg = msg.split('改')[1]
                let redata = this.xiazhutext(newmsg)
                if(redata.isxiazhu){
                  let qxxzuser = this.xiazhumingxi.filter(item => item.userid == message.from)
                  let xiazhu = this.xiazhu.filter(item => item.userid === message.from)
                  xiazhu.forEach(list => {
                  this.deleteItem('my-store', list.id)
                })
                // 账单记录要恢复
                  this.xiazhu = this.xiazhu.filter(item => item.userid !== message.from)
                  this.xiazhumingxi = this.xiazhumingxi.filter(item => item.userid !== message.from)
                  let userzd = this.usernumjl.filter(item => item.userid === message.from)
                  //  冻结流水减去
                  userzd[0].djnum = parseInt(userzd[0].djnum) - parseInt(qxxzuser[0].ls)
                  this.putusernum(userzd[0], userzd[0].id)
                  // 修改下注
                  this.xiazhucl(newmsg, message,user)
                }else{
                  // 修改失败
                  let resmsg = '@' + user[0].nick + ' 修改失败,格式错误'
                  let rqmsg = this.chat.createTextAtMessage({
                    to: message.to,
                    conversationType: TencentCloudChat.TYPES.CONV_GROUP,
                    payload: {
                      text: resmsg,
                      // 'denny' 'lucy' 都是 userID，而非昵称
                      atUserList: [message.from]
                    },
                  })
                  this.chat.sendMessage(rqmsg).then(imResponse => {
                    console.log(imResponse)
                  }).catch(err => {
                    console.log(err)
                  })
                }

              }
            }
          } else if (msg.indexOf("查") == 0 || msg.indexOf("查分") == 0) {
            // 查分
            let msgarr = this.splitByNumbers(msg)
            let num = msgarr[1]
            let regex = /\d+/g;
            if(num.match(regex)){
              let userchid = this.idbhuiindex
              this.idbhuiindex++
              if(user.length != 0){
                let sendou = -1
                if(user[0].iszhenren == '假' && this.num.jiarenisshenhe){
                  let sss =  Math.floor(Math.random() * 30) + 1
                  if(this.num.cys != ""){
                    sss = sss+parseInt(this.num.cys)
                  }
                  sendou = sss
                }
                this.userch.push({
                  nick: user[0].nick,
                  userid: user[0].userid,
                  type: '查',
                  num: num,
                  status: '完成',
                  lashou:user[0].lashou,
                  iszhenren:user[0].iszhenren,
                  id:userchid,
                  sendou:sendou,
                })
              }else{
                this.userch.push({
                  nick: message.nick,
                  userid: message.from,
                  type: '查',
                  num: num,
                  status: '完成',
                  lashou:'',
                  iszhenren:'真',
                  id:userchid,
                  sendou:-1,
                })
              }
              if(user.length != 0 ){
                if(user[0].iszhenren == '真'){
                  this.audio.play()
                }
              }else{
                this.audio.play()
              }
            }
          }else if (msg.indexOf('回') == 0 || msg.indexOf('下') == 0) {
            // 修改下注
            // 回分
            // 要冻结金额djnum
            let msgarr = this.splitByNumbers(msg)
            let num = msgarr[1]
            let regex = /\d+/g;
            let user = this.usernumjl.filter(item => item.userid == message.from)
            if(num.match(regex)){
              if (user.length !== 0) {
                // 账单存在用户
                // 判断回分金额是否满足条件
                if (parseInt(user[0].num) - parseInt(user[0].djnum) >=num && num>0) {
                  // 满足, 回分添加进数组
                  // 冻结金额
                  let userchid = this.idbhuiindex
                  this.idbhuiindex++
                  user[0].djnum = parseInt(user[0].djnum) + parseInt(num)
                  // 上传服务器
                  this.putusernum(user[0],user[0].id)
                  let sendou = -1
                  if(user[0].iszhenren == '假' && this.num.jiarenisshenhe){
                    let sss =  Math.floor(Math.random() * 30) + 1
                    if(this.num.hys != ""){
                      sss = sss+parseInt(this.num.hys)
                    }
                    sendou = sss
                  }
                  this.userch.push({
                    nick: user[0].nick,
                    userid: message.from,
                    type: '回',
                    num: num,
                    status: '完成',
                    lashou:user[0].lashou,
                    iszhenren:user[0].iszhenren,
                    id:userchid,
                    sendou:sendou
                  })
                  if(user.length != 0 ){
                    if(user[0].iszhenren == '真'){
                      this.audio.play()
                    }
                  }else{
                    this.audio.play()
                  }
                } else {
                  //不满足，提醒可用金额不足
                  // 回复失败
                  let resmsg = '@' + user[0].nick + ' 可用余额不足'
                  let rqmsg = this.chat.createTextAtMessage({
                    to: message.to,
                    conversationType: TencentCloudChat.TYPES.CONV_GROUP,
                    payload: {
                      text: resmsg,
                      // 'denny' 'lucy' 都是 userID，而非昵称
                      atUserList: [message.from]
                    },
                  })
                  this.chat.sendMessage(rqmsg).then(imResponse => {
                    console.log(imResponse)
                  }).catch(err => {
                    console.log(err)
                  })
                }
              }else{
                let resmsg = '@' + message.nick + ' 可用余额不足'
                  let rqmsg = this.chat.createTextAtMessage({
                    to: message.to,
                    conversationType: TencentCloudChat.TYPES.CONV_GROUP,
                    payload: {
                      text: resmsg,
                      // 'denny' 'lucy' 都是 userID，而非昵称
                      atUserList: [message.from]
                    },
                  })
                  this.chat.sendMessage(rqmsg).then(imResponse => {
                    console.log(imResponse)
                  }).catch(err => {
                    console.log(err)
                  })
              }
            }
          } else if (msg.indexOf('福利') == 0) {
            let msgarr = this.splitByNumbers(msg)
            let num = msgarr[1]
            let regex = /\d+/g;
            if(num.match(regex)){
              let user = this.usernumjl.filter(item => item.userid == message.from)
              let userchid = this.idbhuiindex
              this.idbhuiindex++
              if(user.length !== 0){
                this.userch.push({
                  nick: user[0].nick,
                  userid: message.from,
                  type: '福利',
                  num: num,
                  status: '完成',
                  lashou:user[0].lashou,
                  iszhenren:user[0].iszhenren,
                  id:userchid
                })
              }else{
                this.userch.push({
                  nick: message.nick,
                  userid: message.from,
                  type: '福利',
                  num: num,
                  status: '完成',
                  lashou:'',
                  iszhenren:'真',
                  id:userchid
                })
              }
              this.audio.play()
            }
          } else if (msg.trim() == '反水' || (msg.trim() == this.num.cfs && this.num.cfs!='')) {
            let resmsg = ''
            let newDay = moment().format('YYYY-MM-DD')
            if (user.length != 0) {
              let userzhongjiang1 = this.userxiazhujl.filter(item => item.userid == message.from && moment(item.create_at).format('YYYY-MM-DD') === newDay)
              let userfanshuijl = this.cachexiazhu.filter(item => item.userid == message.from && moment(item.create_at).format('YYYY-MM-DD') === newDay)
              let ls = userzhongjiang1.reduce((acc, cur) => parseInt(acc) + parseInt(cur.ls), 0)
              let fs = userfanshuijl.reduce((acc, cur) => parseInt(acc) + parseInt(cur.fs), 0)
              let noling = parseInt(parseInt(ls) * parseFloat(this.num.fslv / 100) - fs)
              let fsid = this.cachexiazhu.length == 0 ? 0 : this.cachexiazhu[this.cachexiazhu.length - 1].id + 1
              if (ls < parseInt(this.num.lsqf)) {
                resmsg = '@' + user[0].nick  + ' 今日流水未达标'
              } else {
                // 添加到账单
                let syjf = parseInt(user[0].num)
                if (noling > 0) {
                  let zhangbianid = this.idbzhangbianid
                  this.idbzhangbianid++
                  syjf = syjf + parseInt(noling)
                  let zhangbiandata = {
                    nick: user[0].nick,
                    userid: user[0].userid,
                    id: zhangbianid,
                    ynum: user[0].num,
                    bnum: noling,
                    xnum: syjf,
                    type: '自助反水'
                  }
                  user[0].num = syjf
                  // 上传服务器
                  let fsdata = {
                    id: fsid,
                    userid: message.from,
                    nick: user[0].nick,
                    type: '自助反水',
                    fs: noling,
                  }
                  this.postfs(JSON.parse(JSON.stringify(fsdata)), fsid)
                  this.postzhangbian(JSON.parse(JSON.stringify(zhangbiandata)), zhangbianid)
                  this.putusernum(user[0], user[0].id)
                }
                resmsg = '@' + user[0].nick +" 自助反水"+ '\n' +  '自助反水：' + noling+'\n'+"今日总领取:"+parseInt(noling+fs)+'\n'+'剩余积分：'+ syjf
              }
              let rqmsg = this.chat.createTextAtMessage({
                to: message.to,
                conversationType: TencentCloudChat.TYPES.CONV_GROUP,
                payload: {
                  text: resmsg,
                  // 'denny' 'lucy' 都是 userID，而非昵称
                  atUserList: [message.from]
                },
              })
              this.chat.sendMessage(rqmsg).then(imResponse => {
                console.log(imResponse)
              }).catch(err => {
                console.log(err)
              })
            }else{
              resmsg = '@' + message.nick +" 今日流水未达标"
              let rqmsg = this.chat.createTextAtMessage({
                to: message.to,
                conversationType: TencentCloudChat.TYPES.CONV_GROUP,
                payload: {
                  text: resmsg,
                  // 'denny' 'lucy' 都是 userID，而非昵称
                  atUserList: [message.from]
                },
              })
              this.chat.sendMessage(rqmsg).then(imResponse => {
                console.log(imResponse)
              }).catch(err => {
                console.log(err)
              })
            }
          } else if (msg.trim() == '余额' || (msg.trim() == this.num.cye && this.num.cye!='')) {
            let resmsg = ''
            if (user.length != 0) {
              resmsg = '@' + user[0].nick + '\n'
              resmsg = resmsg + '账单金额：' + user[0].num + '\n' + '冻结金额：' + user[0].djnum + '\n' + '剩余下注余额：' + parseInt((parseInt(user[0].num) - parseInt(user[0].djnum)) / this.num.dzpl)
              let rqmsg = this.chat.createTextAtMessage({
                to: message.to,
                conversationType: TencentCloudChat.TYPES.CONV_GROUP,
                payload: {
                  text: resmsg,
                  // 'denny' 'lucy' 都是 userID，而非昵称
                  atUserList: [message.from]
                },
              })
              this.chat.sendMessage(rqmsg).then(imResponse => {
                console.log(imResponse)
              }).catch(err => {
                console.log(err)
              })
            }else{
              resmsg = '@' + message.nick + '\n'
              resmsg = resmsg + '账单金额：0' +   '\n' + '冻结金额：0' + '\n' + '剩余下注余额：0' 
              let rqmsg = this.chat.createTextAtMessage({
                to: message.to,
                conversationType: TencentCloudChat.TYPES.CONV_GROUP,
                payload: {
                  text: resmsg,
                  // 'denny' 'lucy' 都是 userID，而非昵称
                  atUserList: [message.from]
                },
              })
              this.chat.sendMessage(rqmsg).then(imResponse => {
                console.log(imResponse)
              }).catch(err => {
                console.log(err)
              })
            }
          } else if (msg.trim() == '流水' || (msg.trim() == this.num.cls && this.num.cls!='')) {
            let resmsg = ''
            let newDay = moment().format('YYYY-MM-DD')
            if (user.length != 0) {
              let userzhongjiang1 = this.userxiazhujl.filter(item => item.userid == message.from && moment(item.create_at).format('YYYY-MM-DD') === newDay)
              let ls = userzhongjiang1.reduce((acc, cur) => parseInt(acc) + parseInt(cur.ls), 0)
              let sy = userzhongjiang1.reduce((acc, cur) => parseInt(acc) + parseInt(cur.zjls), 0)
              resmsg = resmsg + '@' + user[0].nick + '\n' + '今日流水：' + ls + '\n' + '今日盈亏：' + sy+'\n'+'今日下注期数：'+userzhongjiang1.length
              let rqmsg = this.chat.createTextAtMessage({
                to: message.to,
                conversationType: TencentCloudChat.TYPES.CONV_GROUP,
                payload: {
                  text: resmsg,
                  // 'denny' 'lucy' 都是 userID，而非昵称
                  atUserList: [message.from]
                },
              })
              this.chat.sendMessage(rqmsg).then(imResponse => {
                console.log(imResponse)
              }).catch(err => {
                console.log(err)
              })
            }else{
              resmsg = '@' + message.nick + '\n'
              resmsg = resmsg + '今日流水：0' +  '\n' + '今日盈亏：0' 
              let rqmsg = this.chat.createTextAtMessage({
                to: message.to,
                conversationType: TencentCloudChat.TYPES.CONV_GROUP,
                payload: {
                  text: resmsg,
                  // 'denny' 'lucy' 都是 userID，而非昵称
                  atUserList: [message.from]
                },
              })
              this.chat.sendMessage(rqmsg).then(imResponse => {
                console.log(imResponse)
              }).catch(err => {
                console.log(err)
              })
            }
          } else if (msg.trim() == '走势' || (msg.trim() == this.num.czs && this.num.czs!='')) {
            let message = this.chat.createImageMessage({
              to: this.xuanGroupList.groupID,
              conversationType: TencentCloudChat.TYPES.CONV_GROUP,
              // 消息优先级，用于群聊
              // priority: TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL,
              payload: {
                file: this.file
              },
              // 消息自定义数据（云端保存，会发送到对端，程序卸载重装后还能拉取到）
              onProgress: function (event) { console.log('file uploading:', event) }
            });
            let promise = this.chat.sendMessage(message);
            promise.then(function (imResponse) {
              // 发送成功
              console.log(imResponse);
            }).catch(function (imError) {
              // 发送失败
              console.warn('sendMessage error:', imError);
            });
          } else if(msg.trim() =='全回'){
            let user = this.usernumjl.filter(item => item.userid == message.from)
              if (user.length !== 0) {
                // 账单存在用户
                // 判断回分金额是否满足条件
                let syky = parseInt(user[0].num) - parseInt(user[0].djnum)
                if (syky > 0) {
                  // 满足, 回分添加进数组
                  // 冻结金额
                  let userchid = this.idbhuiindex
                  this.idbhuiindex++
                  user[0].djnum = parseInt(user[0].djnum) + parseInt(syky)
                  // 上传服务器
                  this.putusernum(user[0],user[0].id)
                  let sendou = -1
                  if(user[0].iszhenren == '假' && this.num.jiarenisshenhe){
                    let sss =  Math.floor(Math.random() * 30) + 1
                    if(this.num.hys != ""){
                      sss = sss+parseInt(this.num.hys)
                    }
                    sendou = sss
                  }
                  this.userch.push({
                    nick: user[0].nick,
                    userid: message.from,
                    type: '回',
                    num: syky,
                    status: '完成',
                    lashou:user[0].lashou,
                    iszhenren:user[0].iszhenren,
                    id:userchid,
                    sendou:sendou
                  })
                  if(user.length != 0 ){
                    if(user[0].iszhenren == '真'){
                      this.audio.play()
                    }
                  }else{
                    this.audio.play()
                  }
                } else {
                  //不满足，提醒可用金额不足
                  // 回复失败
                  let resmsg = '@' + user[0].nick + ' 可用余额为0'
                  let rqmsg = this.chat.createTextAtMessage({
                    to: message.to,
                    conversationType: TencentCloudChat.TYPES.CONV_GROUP,
                    payload: {
                      text: resmsg,
                      // 'denny' 'lucy' 都是 userID，而非昵称
                      atUserList: [message.from]
                    },
                  })
                  this.chat.sendMessage(rqmsg).then(imResponse => {
                    console.log(imResponse)
                  }).catch(err => {
                    console.log(err)
                  })
                }
              }
          }else{
            if (user.length != 0) {
              this.xiazhucl(msg.trim(), message,user)
            }
          }
        }
      })
    },
    textPa(bastr) {
      let srcs = bastr;
      let decrypt = CryptoJS.AES.decrypt(srcs, this.Crypto, {
        mode: CryptoJS.mode.ECB,
        padding: CryptoJS.pad.Pkcs7
      });
      return decrypt.toString(CryptoJS.enc.Utf8)
    },
    xiazhucl(msg, message,user) {
      // 下注文本处理
      // 处理空格
      let date = moment().format("YYYY-MM-DD HH:mm:ss")
      let yedate = moment().format("YYYY-MM-DD")
      msg = msg.replace(/^\s+|\s+$/g, '')
      let text = msg.split(/[\s/]+/)
      let regex = /\d+/g;
      let regexa = /^a\d+/i; // 匹配a
      let regexb = /^b\d+/i; // 匹配b
      let res = 200
      // 判断下注时间是否超时
      if (!this.isfp) {
        console.log('在封盘前')
      } else {
        console.log('在封盘后')
        res = 1
        // 封盘了
        let resmsg = '@' + user[0].nick + ' 下注失败,封盘后无效'
        let rqmsg = this.chat.createTextAtMessage({
          to: message.to,
          conversationType: TencentCloudChat.TYPES.CONV_GROUP,
          payload: {
            text: resmsg,
            // 'denny' 'lucy' 都是 userID，而非昵称
            atUserList: [message.from]
          },
        })
        this.chat.sendMessage(rqmsg).then(imResponse => {
          console.log(imResponse)
        }).catch(err => {
          console.log(err)
        })
        return res
      }
      if (this.idbindex) {
        // 存在
        this.idbindex = parseInt(this.idbindex)
      } else {
        // 不存在
        this.idbindex = 1
      }
      if(msg == '哈b' || msg == '哈B'){
        let lsxiazhu = this.xiazhu.filter(item => item.userid === message.from && item.issue === this.jndkjnextissue)
        let isduiya = false
        lsxiazhu.forEach(list => {
           if (list.type == 'a') {
            isduiya = true
          }
        })
        if(isduiya){
          res = 205
        }else{
          this.xiazhu.push({
          userid: message.from,
          nick: user[0].nick,
          xz: 'b',
          jine: parseInt(parseInt(user[0].num-user[0].djnum)/this.num.dzpl),
          date1: yedate,
          date2: date,
          type: 'b',
          issue: this.jndkjnextissue,
          id: this.idbindex,
          iszhenren:user[0].iszhenren,
        })
        this.addItem('my-store', JSON.parse(JSON.stringify(this.xiazhu[this.xiazhu.length - 1])), this.idbindex)
        this.idbindex = this.idbindex + 1
        }
      }else if(msg == '哈a' || msg == '哈A'){
        let lsxiazhu = this.xiazhu.filter(item => item.userid === message.from && item.issue === this.jndkjnextissue)
        let isduiya = false
        lsxiazhu.forEach(list => {
           if (list.type == 'b') {
            isduiya = true
          }
        })
        if(isduiya){
          res = 205
        }else{
          this.xiazhu.push({
          userid: message.from,
          nick: user[0].nick,
          xz: 'a',
          jine: parseInt(parseInt(user[0].num-user[0].djnum)/this.num.dzpl),
          date1: yedate,
          date2: date,
          type: 'a',
          issue: this.jndkjnextissue,
          id: this.idbindex,
          iszhenren:user[0].iszhenren,
        })
        this.addItem('my-store', JSON.parse(JSON.stringify(this.xiazhu[this.xiazhu.length - 1])), this.idbindex)
        this.idbindex = this.idbindex + 1
        }
      }else{
        for (let i = 0; i < text.length; i++) {
          if (text[i].includes('a') || text[i].includes('A') || text[i].includes('b') || text[i].includes('B')) {
            // 特码前，金额后
            let lsxiazhu = this.xiazhu.filter(item => item.userid === message.from && item.issue === this.jndkjnextissue)
            let isduiya = false
            let tm = text[i].match(regex)
            if (!isNaN(tm[0])) {
              if (parseInt(tm[0]) < parseInt(this.num.xenum) || parseInt(tm[0]) > parseInt(this.num.maxnum)) {
                res = 204
              } else if (regexa.test(text[i])) {
                // 是a
                lsxiazhu.forEach(list => {
                  if (list.type == 'b') {
                    isduiya = true
                  }
                })
                if (isduiya) {
                  res = 205
                } else {
                  this.xiazhu.push({
                    userid: message.from,
                    nick: user[0].nick,
                    xz: 'a',
                    jine: tm[0],
                    date1: yedate,
                    date2: date,
                    type: 'a',
                    issue: this.jndkjnextissue,
                    id: this.idbindex,
                    iszhenren:user[0].iszhenren,
                  })
                  this.addItem('my-store', JSON.parse(JSON.stringify(this.xiazhu[this.xiazhu.length - 1])), this.idbindex)
                  this.idbindex = this.idbindex + 1
                }
              } else if (regexb.test(text[i])) {
                // 是b
                lsxiazhu.forEach(list => {
                  if (list.type == 'a') {
                    isduiya = true
                  }
                })
                if (isduiya) {
                  res = 205
                } else {
                  this.xiazhu.push({
                    userid: message.from,
                    nick: user[0].nick,
                    xz: 'b',
                    jine: tm[0],
                    date1: yedate,
                    date2: date,
                    type: 'b',
                    issue: this.jndkjnextissue,
                    id: this.idbindex,
                    iszhenren:user[0].iszhenren,
                  })
                  this.addItem('my-store', JSON.parse(JSON.stringify(this.xiazhu[this.xiazhu.length - 1])), this.idbindex)
                  this.idbindex = this.idbindex + 1
                }
              } else {
                res = 0
              }
            } else {
              res = 0
            }
          } else {
            res = 0
          }
        }
      }
      if (res === 200) {
        // 下注成功
        // 回复下注成功
        let xia = this.xiazhu.filter(item => item.userid === message.from && item.issue == this.jndkjnextissue)
        let ls = xia.reduce((acc, cur) => parseInt(acc) + parseInt(cur.jine), 0)
        // 获取用户账单
        let user = this.usernumjl.filter(item => item.userid === message.from)
        let ch = this.userch.filter(item => item.userid === message.from && item.type === '回')
        let chls = ch.reduce((acc, cur) => parseInt(acc) + parseInt(cur.num), 0)
        // 判断下注金额是否满足条件（总额-冻结金额）
        let zhenrenbian = user[0].iszhenren
        if (parseInt(user[0].num) - parseInt(chls) >= parseInt(parseInt(ls) * this.num.dzpl)) {
          // 正常下注
          // 下注冻结金额
          // 处理冻结金额（用正在查回的金额+全部下注ls金额）
          user[0].djnum = parseInt(chls) + parseInt(parseInt(ls) * this.num.dzpl)
          let date5 = moment().format("YYYY-MM-DD HH:mm:ss")
          let resmsg = '@' + user[0].nick + '\n' + this.jndkjnextissue + '期下注成功' + '\n' + '下注详细：'
          let xiazhuxx = ''
          let xiazhuarr = []
          xia.forEach((item) => {
            let demo = xiazhuarr.filter(list => list.xz == item.xz)
            if (demo.length > 0) {
              // 存在，不处理
            } else {
              // 不存在 处理
              let xiazhuzhenghe = xia.filter(yesa => yesa.xz === item.xz)
              let xiazhuzhenghels = xiazhuzhenghe.reduce((accumulator, current) => parseInt(accumulator) + parseInt(current.jine), 0)
              xiazhuarr.push({
                xz: item.xz,
                jine: xiazhuzhenghels,
                issue: this.jndkjnextissue,
                type: item.type,
                iszhenren:item.iszhenren,
              })
            }
          })
          xiazhuarr.forEach(item => {
            if (item.type == 'a') {
              xiazhuxx = xiazhuxx + 'a' + item.jine + ' '
            } else {
              xiazhuxx = xiazhuxx + 'b' + item.jine + ' '
            }
          })
          // put冻结金额
          this.putusernum(user[0], user[0].id)
          let syxzye = parseInt((parseInt(user[0].num) - parseInt(user[0].djnum)) / this.num.dzpl)
          resmsg = resmsg + xiazhuxx + '\n' + '冻结金额：' + user[0].djnum + '\n' + '可用余额：' + (parseInt(user[0].num) - parseInt(user[0].djnum)) + '\n' + '可下注余额:' + syxzye
          let xiazhuindex = this.xiazhumingxi.findIndex(item => item.userid === message.from)
          if (xiazhuindex != -1) {
            // 存在，增加修改
            this.xiazhumingxi[xiazhuindex].xz = xiazhuxx
            this.xiazhumingxi[xiazhuindex].ls = ls
            this.xiazhumingxi[xiazhuindex].create_at = date5
            this.xiazhumingxi[xiazhuindex].iszhenren = zhenrenbian

          } else {
            // 不存在，新加 
            this.xiazhumingxi.push({
              userid: message.from,
              nick: user[0].nick,
              xz: xiazhuxx,
              ls: ls,
              issue: this.jndkjnextissue,
              create_at:date5,
              iszhenren:zhenrenbian,
            })
          }
          let rqmsg = this.chat.createTextAtMessage({
            to: message.to,
            conversationType: TencentCloudChat.TYPES.CONV_GROUP,
            payload: {
              text: resmsg,
              // 'denny' 'lucy' 都是 userID，而非昵称
              atUserList: [message.from]
            },
          })
          this.chat.sendMessage(rqmsg).then(imResponse => {
            console.log(imResponse)
          }).catch(err => {
            console.log(err)
          })
        } else {
          // 余额不足
          // 清除格式
          let yyy = this.xiazhu.filter(item => item.date2 === date && item.issue === this.jndkjnextissue)
          console.log(yyy)
          yyy.forEach(item => {
            this.deleteItem('my-store', item.id)
          })
          this.xiazhu = this.xiazhu.filter(item => item.date2 !== date)
          let resmsg = '@' + user[0].nick + ' 下注失败,可下注余额不足'
          let rqmsg = this.chat.createTextAtMessage({
            to: message.to,
            conversationType: TencentCloudChat.TYPES.CONV_GROUP,
            payload: {
              text: resmsg,
              // 'denny' 'lucy' 都是 userID，而非昵称
              atUserList: [message.from]
            },
          })
          this.chat.sendMessage(rqmsg).then(imResponse => {
            console.log(imResponse)
          }).catch(err => {
            console.log(err)
          })
        }
      } else if (res == 0) {
        // 下注失败
        // 回复失败
        let yyy = this.xiazhu.filter(item => item.date2 === date && item.issue === this.jndkjnextissue)
        yyy.forEach(item => {
          this.deleteItem('my-store', item.id)
        })
        this.xiazhu = this.xiazhu.filter(item => item.date2 !== date)
      } else if (res == 204) {
        // 下注限额
        // 回复失败
        let yyy = this.xiazhu.filter(item => item.date2 === date && item.issue === this.jndkjnextissue)
        console.log(yyy)
        yyy.forEach(item => {
          this.deleteItem('my-store', item.id)
        })
        this.xiazhu = this.xiazhu.filter(item => item.date2 !== date)

        let resmsg = '@' + user[0].nick + ' 下注失败' + '\n' + '下注最低限额：' + this.num.xenum + '\n' + '下注最高限额：' + this.num.maxnum + '\n' + '请重新下注'
        let rqmsg = this.chat.createTextAtMessage({
          to: message.to,
          conversationType: TencentCloudChat.TYPES.CONV_GROUP,
          payload: {
            text: resmsg,
            // 'denny' 'lucy' 都是 userID，而非昵称
            atUserList: [message.from]
          },
        })
        this.chat.sendMessage(rqmsg).then(imResponse => {
          console.log(imResponse)
        }).catch(err => {
          console.log(err)
        })
      } else if (res == 205) {
        // 下在庄位
        // 回复失败
        let yyy = this.xiazhu.filter(item => item.date2 === date && item.issue === this.jndkjnextissue)
        console.log(yyy)
        yyy.forEach(item => {
          this.deleteItem('my-store', item.id)
        })
        this.xiazhu = this.xiazhu.filter(item => item.date2 !== date)
        let resmsg = '@' + user[0].nick + ' 下注失败,请勿对压'
        let rqmsg = this.chat.createTextAtMessage({
          to: message.to,
          conversationType: TencentCloudChat.TYPES.CONV_GROUP,
          payload: {
            text: resmsg,
            // 'denny' 'lucy' 都是 userID，而非昵称
            atUserList: [message.from]
          },
        })
        this.chat.sendMessage(rqmsg).then(imResponse => {
          console.log(imResponse)
        }).catch(err => {
          console.log(err)
        })
      }
    },
    splitByNumbers(str) {
      // 使用正则表达式匹配数字边界，并以此进行分割
      return str.split(/(\d+)/);
    },
    isNumberAtTheBeginning(str) {
      // 开头
      return /^\d/.test(str);
    },
    isNumberAtTheEnd(str) {
      // 结尾
      return /\d$/.test(str);
    },
    getuserchAll() {
      // 获取所有用户的查回记录
      this.getItems('userch').then(res => {
        if (res.length != 0) {
          this.userchjl = res
        } else {
          this.userchjl = []
        }
      })
    },
    getlskj() {
      this.getItems('kaijshezhi').then(res => {
        if (res.length != 0) {
          this.lskaijiang = res
          this.idblskjindex = parseInt(res[res.length - 1].id) + 1
        } else {
          this.lskaijiang = []
          this.idblskjindex = 0
        }
      })
    },
    getusernumAll() {
      // 获取所有用户的账单数据
      this.getItems('usernum').then(res => {
        if (res.length != 0) {
          this.usernumjl = res
        } else {
          this.usernumjl = []
        }
      })
    },
    getuserxiazhujlAll() {
      // 获取所有用户的中奖数据
      this.getItems('zhongjiang').then(res => {
        if (res.length != 0) {
          this.userxiazhujl = res
        } else {
          this.userxiazhujl = []
        }
      })
    },
    postuserch(data, id) {
      // 新增用户查回记录
      this.addItem('userch', data, id)
      this.getuserchAll()
    },
    postlskj(data, id) {
      this.addItem('kaijshezhi', data, id)
      this.getlskj()
    },
    postzhangbian(data, id) {
      this.addItem('zhangbian', data, id)
      this.getzhangbian()
    },
    postzhangbian3(data, id) {
      this.addItem('zhangbian', data, id)
    },
    postzhangbian2(data) {
      this.addItem2('zhangbian', data)
      this.getItems('zhangbian').then(res => {
        if (res.length != 0) {
          this.zhangbianjl = res
          this.idbzhangbianid = this.zhangbianjl[this.zhangbianjl.length-1].id+1
        } else {
          this.zhangbianjl = []
          this.idbzhangbianid =0
        }
      })
    },
    getzhangbian() {
      this.getItems('zhangbian').then(res => {
        if (res.length != 0) {
          this.zhangbianjl = res
        } else {
          this.zhangbianjl = []
        }
      })
    },
    postuserxiazhu(data, id) {
      this.addItem('userxiazhu', data, id)
      this.getItems('userxiazhu').then(res => {
        if (res.length != 0) {
          this.userxiazhumingxi = res
        } else {
          this.userxiazhumingxi = []
        }
      })
    },
    postfs(data, id) {
      // 新增用户账单
      this.addItem('cachexiazhu', data, id)
      this.getfs()
    },
    postfs2(data) {
      // 新增用户账单
      this.addItem2('cachexiazhu', data)
      this.getfs()
    },
    getfs() {
      this.getItems('cachexiazhu').then(res => {
        if (res.length != 0) {
          this.cachexiazhu = res
        } else {
          this.cachexiazhu = []
        }
      })
    },
    postusernum(data, id) {
      // 新增用户账单
      this.addItem('usernum', data, id)
      this.getusernumAll()
    },
    postzhongjiang(data, id) {
      this.addItem('zhongjiang', data, id)
      this.getuserxiazhujlAll()
    },
    postzhongjiang2(data, id) {
      this.addItem('zhongjiang', data, id)
    },
    postadmin(data, id) {
      this.addItem('admininfo', data, id)
    },
    getadmininfo() {
      this.getItems('admininfo').then(res => {
        if (res.length != 0) {
          this.admininfo = res
        } else {
          this.admininfo = []
        }
      })
    },
    putusernum(data, id) {
      // 修改用户账单金额
      this.updateItem('usernum', data, id)
      this.getusernumAll()
    },
    putusernum2(data, id) {
      // 修改用户账单金额
      this.updateItem('usernum', data, id)
    },
    deletech(id) {
      this.deleteItem('userch', id)
      ElMessage({
        message: '撤回成功',
        type: 'success',
      })
      this.getuserchAll()
    },
    reAll() {
      // 冻结金额要减去
      let admininfoid = this.admininfo.length!=0?this.admininfo[this.admininfo.length-1].id+1:0
      let text = "删除全部未结算下注----》成功"
      let admininfoy = {
      id:admininfoid,
      infodate:moment().format("YYYY-MM-DD HH:mm:ss"),
      conter:text
      }
      this.postadmin(admininfoy,admininfoid)
      this.admininfo.push(admininfoy)

      this.xiazhumingxi.forEach(item => {
        let user = this.usernumjl.filter(list => list.userid === item.userid)
        user[0].djnum = parseInt(user[0].djnum) - parseInt(item.ls)*parseInt(this.num.dzpl)
        this.putusernum(user[0], user[0].id)
      })
      this.xiazhu.forEach(list => {
        this.deleteItem('my-store', list.id)
      })
      this.xiazhu = []
      this.xiazhumingxi = []
      ElMessage({
        message: '全部删除本期下注成功',
        type: 'success',
      })
      this.getxiazhull()
    },
    shanchuxiazhu(index, row) {
      console.log(index)
      // 冻结金额要减去
      let admininfoid = this.admininfo.length!=0?this.admininfo[this.admininfo.length-1].id+1:0
      let text = '用户：'+row.nick+"=>ID："+row.userid+"---删除"+row.issue+"期下注--->成功"
      let admininfoy = {
      id:admininfoid,
      infodate:moment().format("YYYY-MM-DD HH:mm:ss"),
      conter:text
      }
      this.postadmin(admininfoy,admininfoid)
      this.admininfo.push(admininfoy)

      let user = this.usernumjl.filter(list => list.userid === row.userid)
      user[0].djnum = parseInt(user[0].djnum) - parseInt((parseInt(row.ls) * this.num.dzpl))
      this.putusernum(user[0], user[0].id)
      let xiazhu = this.xiazhu.filter(item => item.userid == row.userid)
      xiazhu.forEach(list => {
        this.deleteItem('my-store', list.id)
      })
      ElMessage({
        message: '删除用户' + row.nick +  '本期下注成功',
        type: 'success',
      })
      this.xiazhu = []
      this.xiazhumingxi = []
      this.getxiazhull()
    },
    addadv() {
      this.addItem('adv', { text: this.textarea2, fasongnum: this.fasongnum, id: this.idbadvindex }, this.idbadvindex)
      this.idbadvindex = this.idbadvindex + 1
      this.getItems('adv').then(res => {
        if (res.length != 0) {
          this.adv = res
          this.idbadvindex = res[res.length - 1].id + 1
        } else {
          this.adv = []
          this.idbadvindex = 1
        }
      })
      this.textarea2 = ''
      this.fasongnum = 0
      this.dialogTableVisible = false
    },
    sendadv(index, row) {
      console.log(index)
      let resmsg = row.text
      let rqmsg = this.chat.createTextMessage({
        to: this.xuanGroupList.groupID,
        conversationType: TencentCloudChat.TYPES.CONV_GROUP,
        payload: {
          text: resmsg,
          // 'denny' 'lucy' 都是 userID，而非昵称
        },
      })
      this.chat.sendMessage(rqmsg).then(imResponse => {
        console.log(imResponse)
      }).catch(err => {
        console.log(err)
      })
    },
    readv(index, row) {
      console.log(index)
      this.deleteItem('adv', row.id)
      this.getItems('adv').then(res => {
        if (res.length != 0) {
          this.adv = res
          this.idbadvindex = res[res.length - 1].id + 1
        } else {
          this.adv = []
          this.idbadvindex = 1
        }
      })
      ElMessage({
        message: '删除成功',
        type: 'success',
      })
    },
    baocuntuo() {
      this.updateItem('num', { id: 2, data: this.xiazhutuo }, 2)
      ElMessage({
        message: '保存成功',
        type: 'success',
      })
      this.getItems('num').then(res => {
        if (res[1].data) {
          this.xiazhutuo = res[1].data
        } else {
          this.xiazhutuo = ''
        }
      })
    },
    bianji(index, row) {
      this.formusernum = JSON.parse(JSON.stringify(row))
      this.xiugaiusernumindex = parseInt(index) + 1
      this.dialogFormVisibleusernum = true
    },
    bianji2(index, row) {
      this.formusernum2 = JSON.parse(JSON.stringify(row))
      this.xiugaiusernumindex2 = parseInt(index) 
      this.dialogFormVisibleuserch = true
    },
    baocunbianji() {
      let renick = this.usernumjl.filter(item=>item.nick === this.formusernum.nick)
      if(renick.length!=0){
        if(renick[0].userid != this.formusernum.userid){
          ElMessage({
            message: '修改失败，用户名重复',
            type: 'error',
          })
          return false
        }
      }
      let user = this.usernumjl.filter(item=>item.userid == this.formusernum.userid)
      if(user[0].nick!=this.formusernum.nick){
        // 修改了用户名
        let admininfoid = this.admininfo.length!=0?this.admininfo[this.admininfo.length-1].id+1:0
        let text = '用户：'+this.formusernum.nick+"=>ID："+this.formusernum.userid+" 修改用户名为："+this.formusernum.nick+" 原用户名："+user[0].nick
        let admininfoy = {
          id:admininfoid,
          infodate:moment().format("YYYY-MM-DD HH:mm:ss"),
          conter:text
        }
        this.postadmin(admininfoy,admininfoid)
        this.admininfo.push(admininfoy)
      }

        if(user[0].num!=this.formusernum.num){
        // 修改了用户金额
          let admininfoid = this.admininfo.length!=0?this.admininfo[this.admininfo.length-1].id+1:0
          let text = '用户：'+this.formusernum.nick+"=>ID："+this.formusernum.userid+" 修改金额为："+this.formusernum.num+" 原金额："+user[0].num
          let admininfoy = {
            id:admininfoid,
            infodate:moment().format("YYYY-MM-DD HH:mm:ss"),
            conter:text
          }
          this.postadmin(admininfoy,admininfoid)
          this.admininfo.push(admininfoy)
      }


        if(user[0].djnum!=this.formusernum.djnum){
        // 修改了用户冻结金额
          let admininfoid = this.admininfo.length!=0?this.admininfo[this.admininfo.length-1].id+1:0
          let text = '用户：'+this.formusernum.nick+"=>ID："+this.formusernum.userid+" 修改冻结金额为："+this.formusernum.djnum+" 原冻结金额："+user[0].djnum
          let admininfoy = {
            id:admininfoid,
            infodate:moment().format("YYYY-MM-DD HH:mm:ss"),
            conter:text
          }
          this.postadmin(admininfoy,admininfoid)
          this.admininfo.push(admininfoy)
      }
        if(user[0].iszhenren!=this.formusernum.iszhenren){
        // 修改了用户是否真假人
          let admininfoid = this.admininfo.length!=0?this.admininfo[this.admininfo.length-1].id+1:0
          let text = '用户：'+this.formusernum.nick+"=>ID："+this.formusernum.userid+" 修改为："+this.formusernum.iszhenren+"人"
          let admininfoy = {
            id:admininfoid,
            infodate:moment().format("YYYY-MM-DD HH:mm:ss"),
            conter:text
          }
          this.postadmin(admininfoy,admininfoid)
          this.admininfo.push(admininfoy)
        }
      this.putusernum(this.formusernum, this.formusernum.id)
      this.xiugainick(this.formusernum.userid,this.formusernum.nick,this.formusernum.iszhenren)
      this.dialogFormVisibleusernum = false
      ElMessage({
        message: '修改成功',
        type: 'success',
      })
      
    },
    bianjiuserxiazhu(index, row){
      console.log(index)
      this.formuserxiazhu2 = JSON.parse(JSON.stringify(row))
      this.dialogFormVisibleuserxiazhu = true
    },
    baocunbianji4(){
      let renick= this.usernumjl.filter(item=>item.nici == this.formuserxiazhu2.nick)
      if(renick.length!=0){
        if(renick[0].userid !=this.formuserxiazhu2.userid){
          ElMessage({
            message: '修改失败，用户名重复',
            type: 'error',
          })
          return false
        }
      }
      let resxiazhu = this.xiazhutext(this.formuserxiazhu2.xz)
      let user = this.usernumjl.filter(item => item.userid == this.formuserxiazhu2.userid)
      if(user[0].nick!= this.formuserxiazhu2.nick){
        let admininfoid = this.admininfo.length!=0?this.admininfo[this.admininfo.length-1].id+1:0
        let text = '用户：'+this.formuserxiazhu2.nick+"=>ID："+this.formuserxiazhu2.userid+" 修改用户名为："+this.formuserxiazhu2.nick+" 原用户名为："+user[0].nick
        let admininfoy = {
        id:admininfoid,
        infodate:moment().format("YYYY-MM-DD HH:mm:ss"),
        conter:text
        }
        this.postadmin(admininfoy,admininfoid)
        this.admininfo.push(admininfoy)
      }
      if(resxiazhu.isxiazhu){
        // 下注格式正确
        // 先下注再添加下注
        let date = moment().format("YYYY-MM-DD HH:mm:ss")
        let yedate = moment().format("YYYY-MM-DD")
        user[0].djnum = parseInt(user[0].djnum) - parseInt((parseInt(this.formuserxiazhu2.ls) * this.num.dzpl))
        let xiugaixiazhu = this.xiazhumingxi.filter(item=>item.userid == this.formuserxiazhu2.userid && item.issue == this.formuserxiazhu2.issue)
        let admininfoid = this.admininfo.length!=0?this.admininfo[this.admininfo.length-1].id+1:0
        let text = '用户：'+this.formuserxiazhu2.nick+"=>ID："+this.formuserxiazhu2.userid+" 修改"+this.formuserxiazhu2.issue+"期下注为："+this.formuserxiazhu2.xz+" 原下注为："+xiugaixiazhu[0].xz
        let admininfoy = {
        id:admininfoid,
        infodate:moment().format("YYYY-MM-DD HH:mm:ss"),
        conter:text
        }
        this.postadmin(admininfoy,admininfoid)
        this.admininfo.push(admininfoy)
        let xiazhu = this.xiazhu.filter(item => item.userid == this.formuserxiazhu2.userid && item.issue == this.formuserxiazhu2.issue)
        xiazhu.forEach(list => {
          this.deleteItem('my-store', list.id)
        })
        this.xiazhu.push({
          userid: this.formuserxiazhu2.userid,
          nick: this.formuserxiazhu2.nick,
          xz: resxiazhu.type,
          jine: resxiazhu.ls,
          date1: yedate,
          date2: date,
          type: resxiazhu.type,
          issue: this.formuserxiazhu2.issue,
          id: this.idbindex,
          iszhenren:this.formuserxiazhu2.iszhenren,
          create_at:date
        })
        this.addItem('my-store', JSON.parse(JSON.stringify(this.xiazhu[this.xiazhu.length - 1])), this.idbindex)
        this.idbindex = this.idbindex + 1
        this.xiazhu = []
        this.xiazhumingxi = []
        this.getxiazhull()
        user[0].nick = this.formuserxiazhu2.nick
        user[0].djnum = parseInt(user[0].djnum) + parseInt((parseInt(resxiazhu.ls) * this.num.dzpl))
        this.putusernum(user[0], user[0].id)
        this.xiugainick(this.formuserxiazhu2.userid,this.formuserxiazhu2.nick,user[0].iszhenren)
        ElMessage({
          message: '修改成功',
          type: 'success',
        })
        this.dialogFormVisibleuserxiazhu = false
      }else{
        // 下注格式错误
        // 不修改提示错误
        ElMessage({
          message: '修改失败，格式错误',
          type: 'error',
        })
        this.xiazhu = []
        this.xiazhumingxi = []
        this.getxiazhull()
        this.dialogFormVisibleuserxiazhu = false
      }
    

    },
    xiazhutext(str){
      // 下注文本处理
      let res = {
        isxiazhu:false,
        type:'a',
        ls:0
      }
      let regexa = str.match(/a\d+/g)
      let regexA = str.match(/A\d+/g)
      let regexB = str.match(/B\d+/g)
      let regexb = str.match(/b\d+/g)
      let regexNum = /\d+/g
      if(regexa || regexA){
        // 是a
        res.type = 'a'
        if(regexa){
          regexa.forEach(list=>{
            let xzls = list.match(regexNum)
            res.ls = res.ls +parseInt(xzls[0])
          })
        }
        if(regexA){
          regexA.forEach(list=>{
            let xzls = list.match(regexNum)
            res.ls = res.ls +parseInt(xzls[0])
          })
        }
        res.isxiazhu = true
        return res
      }else if(regexb || regexB){
        // 是a
        res.type = 'b'
        if(regexb){
          regexb.forEach(list=>{
            let xzls = list.match(regexNum)
            res.ls = res.ls +parseInt(xzls[0])
          })
        }
        if(regexB){
          regexB.forEach(list=>{
            let xzls = list.match(regexNum)
            res.ls = res.ls +parseInt(xzls[0])
          })
        }
        res.isxiazhu = true
        return res
      }else{
        res = {
          isxiazhu:false,
          type:'a',
          ls:0
        }
        return res
      }
    },
    baocunbianji2(){
      // 同意
      // 点击完成了，要修改用户账单
      let renick = this.usernumjl.filter(item=>item.nick == this.formusernum2.nick)
      if(renick.length!=0){
        if(renick[0].userid!=this.formusernum2.userid){
          ElMessage({
              message: '失败，用户名重复',
              type: 'error',
          })
          return false
        }
      }
      let user = this.usernumjl.filter(item => item.userid == this.formusernum2.userid)
      // 获取到了用户的详细
      let zhangbianid = this.idbzhangbianid
      this.idbzhangbianid++
      let zhangbiandata = null
      if (this.formusernum2.type === '查' || this.formusernum2.type === '福利') {
        // 这是查
        // 判断是否新加的用户
        if (user.length === 0) {
          // 是新用户，需要post
          let userid = this.idbusernumjlid
          this.idbusernumjlid++
          user = [{
            nick: this.formusernum2.nick,
            num: this.formusernum2.num,
            userid: this.formusernum2.userid,
            djnum: '0',
            iszhenren:this.formusernum2.iszhenren,
            lashou:this.formusernum2.lashou,
            id:userid
          }]
          // 上传到数据库
          zhangbiandata = {
            nick: this.formusernum2.nick,
            userid: this.formusernum2.userid,
            id: zhangbianid,
            ynum: 0,
            bnum: this.formusernum2.num,
            xnum: this.formusernum2.num,
            type: '首次上分'
          }
          let sykyye = parseInt((parseInt(user[0].num) - parseInt(user[0].djnum)) / this.num.dzpl)
          let resmsg = '@' + this.formusernum2.nick + ' 上分' + this.formusernum2.num + '成功' + '\n' + '账单金额：' + user[0].num + '\n' + '冻结金额：' + user[0].djnum + '\n' + '可用余额：' + (parseInt(user[0].num) - parseInt(user[0].djnum)) + '\n' + '剩余下注余额：' + sykyye
          let rqmsg = this.chat.createTextAtMessage({
            to: this.xuanGroupList.groupID,
            conversationType: TencentCloudChat.TYPES.CONV_GROUP,
            payload: {
              text: resmsg,
              // 'denny' 'lucy' 都是 userID，而非昵称
              atUserList: [this.formusernum2.userid]
            },
          })
          this.chat.sendMessage(rqmsg).then(imResponse => {
            console.log(imResponse)
            this.postusernum(user[0], userid)
            this.postuserch(JSON.parse(JSON.stringify(this.formusernum2)), this.formusernum2.id)
          }).catch(err => {
            console.log(err)
          })
        } else {
          // 是老用户 需要修改put
          if(user[0].nick!=this.formusernum2.nick){
            let admininfoid = this.admininfo.length!=0?this.admininfo[this.admininfo.length-1].id+1:0
            let text = '用户：'+this.formusernum2.nick+"=>ID："+this.formusernum2.userid+" 修改用户名为："+this.formusernum2.nick+" 原用户名为："+user[0].nick
            let admininfoy = {
            id:admininfoid,
            infodate:moment().format("YYYY-MM-DD HH:mm:ss"),
            conter:text
            }
            this.postadmin(admininfoy,admininfoid)
            this.admininfo.push(admininfoy)
          }
          if(user[0].iszhenren!=this.formusernum2.iszhenren){
            let admininfoid = this.admininfo.length!=0?this.admininfo[this.admininfo.length-1].id+1:0
            let text = '用户：'+this.formusernum2.nick+"=>ID："+this.formusernum2.userid+" 修改为："+this.formusernum2.iszhenren+"人"
            let admininfoy = {
            id:admininfoid,
            infodate:moment().format("YYYY-MM-DD HH:mm:ss"),
            conter:text
            }
            this.postadmin(admininfoy,admininfoid)
            this.admininfo.push(admininfoy)
          }
          zhangbiandata = {
            nick: this.formusernum2.nick,
            userid: this.formusernum2.userid,
            id: zhangbianid,
            ynum: user[0].num,
            bnum: this.formusernum2.num,
            xnum: parseInt(user[0].num) + parseInt(this.formusernum2.num),
            type: '用户上分/领福利'
          }
          user[0].num = parseInt(user[0].num) + parseInt(this.formusernum2.num)
          user[0].nick = this.formusernum2.nick
          user[0].lashou = this.formusernum2.lashou
          user[0].iszhenren = this.formusernum2.iszhenren
          // 上传到数据库
          
          let sykyye = parseInt((parseInt(user[0].num) - parseInt(user[0].djnum)) / this.num.dzpl)
          let resmsg = '@' + this.formusernum2.nick + ' 上分' + this.formusernum2.num + '成功' + '\n' + '账单金额：' + user[0].num + '\n' + '冻结金额：' + user[0].djnum + '\n' + '可用余额：' + (parseInt(user[0].num) - parseInt(user[0].djnum)) + '\n' + '剩余下注余额：' + sykyye
          let rqmsg = this.chat.createTextAtMessage({
            to: this.xuanGroupList.groupID,
            conversationType: TencentCloudChat.TYPES.CONV_GROUP,
            payload: {
              text: resmsg,
              // 'denny' 'lucy' 都是 userID，而非昵称
              atUserList: [this.formusernum2.userid]
            },
          })
          this.chat.sendMessage(rqmsg).then(imResponse => {
            console.log(imResponse)
            this.putusernum(user[0],user[0].id )
            this.postuserch(JSON.parse(JSON.stringify(this.formusernum2)), this.formusernum2.id)
          }).catch(err => {
            console.log(err)
          })
        }
        // 发送上分成功通知

      } else if (this.formusernum2.type == '回') {
        // 这是处理回的信息
        zhangbiandata = {
          nick: user[0].nick,
          userid: user[0].userid,
          id: zhangbianid,
          ynum: user[0].num,
          bnum: parseInt(this.formusernum2.num) * -1,
          xnum: parseInt(user[0].num) - parseInt(this.formusernum2.num),
          type: '用户下分'
        }
        if(parseInt(user[0].num) - parseInt(this.formusernum2.num)>0){
          user[0].num = parseInt(user[0].num) - parseInt(this.formusernum2.num)
          user[0].djnum = parseInt(user[0].djnum) - parseInt(this.formusernum2.num)
          user[0].iszhenren = this.formusernum2.iszhenren
          this.putusernum(user[0], user[0].id)
          // 发送下分成功通知
          this.postuserch(JSON.parse(JSON.stringify(this.formusernum2)), this.formusernum2.id)
          let resmsg = '@' + this.formusernum2.nick + ' 回分' + this.formusernum2.num + '成功,请注意查收'
          let rqmsg = this.chat.createTextAtMessage({
            to: this.xuanGroupList.groupID,
            conversationType: TencentCloudChat.TYPES.CONV_GROUP,
            payload: {
              text: resmsg,
              // 'denny' 'lucy' 都是 userID，而非昵称
              atUserList: [this.formusernum2.userid]
            },
          })
          this.chat.sendMessage(rqmsg).then(imResponse => {
            console.log(imResponse)
          }).catch(err => {
            console.log(err)
          })
        }
      }else{
        ElMessage({
            message: '失败，请检查用户账单',
            type: 'error',
          })
        return false
      }
      this.postzhangbian(JSON.parse(JSON.stringify(zhangbiandata)), zhangbianid)
      this.userch = this.userch.filter(list=>list.id !== this.formusernum2.id)
      this.xiugainick(this.formusernum2.userid,this.formusernum2.nick,this.formusernum2.iszhenren)
      this.dialogFormVisibleuserch = false
    },
    baocunbianji3() {
      // 拒绝
      let renick = this.usernumjl.filter(item=>item.nick == this.formusernum2.nick)
      if(renick.length!=0){
        if(renick[0].userid!=this.formusernum2.userid){
          ElMessage({
              message: '失败，用户名重复',
              type: 'error',
          })
          return false
        }
      }
      this.formusernum2.status = '拒绝'
      if (this.formusernum2.type == '回') {
        let user = this.usernumjl.filter(item => item.userid == this.formusernum2.userid)
        user[0].djnum = parseInt(user[0].djnum) - parseInt(this.formusernum2.num)
        this.putusernum(user[0], user[0].id)
        // 发送通知
        this.postuserch(JSON.parse(JSON.stringify(this.formusernum2)), this.formusernum2.id)
        let resmsg = '@' + this.formusernum2.nick + ' 回分' + this.formusernum2.num + '失败'
        let rqmsg = this.chat.createTextAtMessage({
          to: this.xuanGroupList.groupID,
          conversationType: TencentCloudChat.TYPES.CONV_GROUP,
          payload: {
            text: resmsg,
            // 'denny' 'lucy' 都是 userID，而非昵称
            atUserList: [this.formusernum2.userid]
          },
        })
        this.chat.sendMessage(rqmsg).then(imResponse => {
          console.log(imResponse)
        }).catch(err => {
          console.log(err)
        })
      } else if (this.formusernum2.type == '查') {
        // 发送通知
        this.postuserch(JSON.parse(JSON.stringify(this.formusernum2)), this.formusernum2.id)
        let resmsg = '@' + this.formusernum2.nick + ' 上分' + this.formusernum2.num + '失败'
        let rqmsg = this.chat.createTextAtMessage({
          to: this.xuanGroupList.groupID,
          conversationType: TencentCloudChat.TYPES.CONV_GROUP,
          payload: {
            text: resmsg,
            // 'denny' 'lucy' 都是 userID，而非昵称
            atUserList: [this.formusernum2.userid]
          },
        })
        this.chat.sendMessage(rqmsg).then(imResponse => {
          console.log(imResponse)
        }).catch(err => {
          console.log(err)
        })
      } else if (this.formusernum2.type == '福利') {
        this.postuserch(JSON.parse(JSON.stringify(this.formusernum2)), this.formusernum2.id)
        let resmsg = '@' + this.formusernum2.nick + ' 领取福利' + this.formusernum2.num + '失败'
        let rqmsg = this.chat.createTextAtMessage({
          to: this.xuanGroupList.groupID,
          conversationType: TencentCloudChat.TYPES.CONV_GROUP,
          payload: {
            text: resmsg,
            // 'denny' 'lucy' 都是 userID，而非昵称
            atUserList: [this.formusernum2.userid]
          },
        })
        this.chat.sendMessage(rqmsg).then(imResponse => {
          console.log(imResponse)
        }).catch(err => {
          console.log(err)
        })
      }
      
      this.userch = this.userch.filter(list=>list.id!==this.formusernum2.id)
      this.dialogFormVisibleuserch = false

    },
    startadmin() {
      if (!this.isstart) {
        if (this.xuanGroupList.groupID) {
          // 存在群
          this.isstart = true
          ElMessage({
            message: '系统开启成功',
            type: 'success',
          })
          this.getjndkj()
          this.workerF()
          if(this.num.qidongtext!=''){
            let rqmsg = this.chat.createTextMessage({
              to: this.xuanGroupList.groupID,
              conversationType: TencentCloudChat.TYPES.CONV_GROUP,
              payload: {
                text: this.num.qidongtext,
                // 'denny' 'lucy' 都是 userID，而非昵称
              },
            })
            this.chat.sendMessage(rqmsg).then(imResponse => {
              console.log(imResponse)
            }).catch(err => {
              console.log(err)
            })
          }
        } else {
          // 不存在
          ElMessage({
            message: '没有选择群',
            type: 'error',
          })
        }
      } else {
        this.isstart = false
        ElMessage({
          message: '系统停止成功',
          type: 'success',
        })
        this.worker.postMessage({
          type: "stop",
        })
        if(this.num.tingzhitext!=''){
          let rqmsg = this.chat.createTextMessage({
            to: this.xuanGroupList.groupID,
            conversationType: TencentCloudChat.TYPES.CONV_GROUP,
            payload: {
              text: this.num.tingzhitext,
              // 'denny' 'lucy' 都是 userID，而非昵称
            },
          })
          this.chat.sendMessage(rqmsg).then(imResponse => {
            console.log(imResponse)
          }).catch(err => {
            console.log(err)
          })
        }
      }

    },
    onKickedOut() {
      this.chat.destroy()
      this.onSubmit()
    },
    getjndkj() {
      if(this.kjapi == 1){
        axios.get("https://api.kkaakj.com/open/history?game=Canadian").then(res => {
          this.jndkjdata = []
          if (res.data.resultCode) {
            for (let index = 0; index < 20; index++) {
              this.jndkjdata.push(res.data.data[res.data.data.length-1-index])
              this.jndkjdata[index].LotResultNo = this.jndkjdata[index].num[0]+" + "+this.jndkjdata[index].num[1]+" + " +this.jndkjdata[index].num[2]+" = "+parseInt(this.jndkjdata[index].num[0]+this.jndkjdata[index].num[1]+this.jndkjdata[index].num[2])
              this.jndkjdata[index].LotNumber =  this.jndkjdata[index].qihao
              let numbers = this.jndkjdata[index].LotResultNo.match(/\d+/g)
              let c1 = this.getjndniuniuc1(parseInt(numbers[0]), parseInt(numbers[1]))
              let c2 = this.getjndniuniuc2(parseInt(numbers[1]), parseInt(numbers[2]))
              let sy = this.getjndniuniusy(c1, c2)
              this.jndkjdata[index].c1 = c1
              this.jndkjdata[index].c2 = c2
              this.jndkjdata[index].sy = sy
            }
            
            this.jndkjnewissue = parseInt(this.jndkjdata[0].qihao)
            if (this.jndkjnextissue == 0) {
              this.jndkjnextissue = parseInt(this.jndkjdata[0].qihao) + 1
            }
            if (this.jndkjnewissue == this.jndkjnextissue) {
              // 开奖
              this.jndkjnextissue = this.jndkjnewissue + 1
            }
            let newkjdtime =this.jndkjdata[0].drawDate
            newkjdtime = moment(newkjdtime).format('YYYY-MM-DD HH:mm:ss')
            let nextkjtime =moment(newkjdtime).add(210,'seconds')
            this.jndkjDtime = nextkjtime.diff(new Date(),'seconds')
          } else {
            ElMessage({
              message: '获取开奖失败，请重试',
              type: 'error',
            })
          }
        })
      }else{
        axios.get("https://api.ts28.com.cn/getjndkj2").then(res => {
          this.jndkjdata = []
          if(res.data.code == 1){
            for (let index = 0; index < 20; index++) {
              this.jndkjdata.push(res.data.data[index])
              let kjnumdd  = this.jndkjdata[index].opennum.split('+')
              this.jndkjdata[index].LotResultNo = kjnumdd[0]+ "+ " + kjnumdd[1]+ " + " +kjnumdd[2]+" = "+this.jndkjdata[index].sum
              this.jndkjdata[index].LotNumber =  this.jndkjdata[index].qihao
              let numbers = this.jndkjdata[index].LotResultNo.match(/\d+/g)
              let c1 = this.getjndniuniuc1(parseInt(numbers[0]), parseInt(numbers[1]))
              let c2 = this.getjndniuniuc2(parseInt(numbers[1]), parseInt(numbers[2]))
              let sy = this.getjndniuniusy(c1, c2)
              this.jndkjdata[index].c1 = c1
              this.jndkjdata[index].c2 = c2
              this.jndkjdata[index].sy = sy
              this.jndkjdata[index].drawDate = moment().format("YYYY") + "-"+ this.jndkjdata[index].date
            }
            this.jndkjnewissue = parseInt(this.jndkjdata[0].qihao)
            if (this.jndkjnextissue == 0) {
              this.jndkjnextissue = parseInt(this.jndkjdata[0].qihao) + 1
            }
            if (this.jndkjnewissue == this.jndkjnextissue) {
              // 开奖
              this.jndkjnextissue = this.jndkjnewissue + 1
            }
            let newkjdtime =moment().format('YYYY-') + this.jndkjdata[0].opentime
            newkjdtime = moment(newkjdtime).format('YYYY-MM-DD HH:mm:ss')
            let nextkjtime =moment(newkjdtime).add(210,'seconds')
            this.jndkjDtime = nextkjtime.diff(new Date(),'seconds')
          }
          
        })
      }
    },
    getjndniuniuc1(c1, c2) {
      const niuniumap = ['牛', '一', '二', '三', '四', '五', '六', '七', '八', '九']
      if (c1 == c2) {
        return '对子'
      } else
        if (c1 == 0) {
          return '金牛'
        } else {
          let weiba = (c1 + c2) % 10
          return '牛' + niuniumap[weiba]
        }

    },
    getjndniuniuc2(c2, c3) {
      const niuniumap = ['牛', '一', '二', '三', '四', '五', '六', '七', '八', '九']
      if (c3 == c2) {
        return '对子'
      } else
        if (c3 == 0) {
          return '金牛'
        } else {
          let weiba = (c3 + c2) % 10
          return '牛' + niuniumap[weiba]
        }
    },
    getjndniuniusy(t1, t2) {
      const niuniumap = ['对子', '金牛', '牛牛', '牛九', '牛八', '牛七', '牛六', '牛五', '牛四', '牛三', '牛二', '牛一']
      let c1 = niuniumap.indexOf(t1)
      let c2 = niuniumap.indexOf(t2)

      if (c1 == c2) {
        return '通杀'
      }
      if (c1 > c2) {
        // c1比c2牛小
        return 'B注赢'
      } else {
        // c1比c2牛大
        return 'A注赢'
      }
    },
    workerF() {
      this.worker.postMessage({
        type: "start",
        interval: 1000
      })
      this.worker.onmessage = (event) => {
        // 收息消息
        if (event.data.type == 'message') {
          this.jndkjDtime--;
          if(this.num.jiarenisshenhe){
            let jiarench = this.userch.filter(item=>item.sendou !=-1 )
            jiarench.forEach(list=>{
              list.sendou = list.sendou-1
              if(list.sendou == 0 && list.iszhenren=='假'){
                // 完成审核修改账单
                let user = this.usernumjl.filter(item => item.userid == list.userid)
                // 获取到了用户的详细
                let zhangbianid = this.idbzhangbianid
                this.idbzhangbianid++
                let zhangbiandata = null
                if (list.type === '查' ) {
                  // 这是查
                  // 判断是否新加的用户
                  if (user.length === 0) {
                    // 是新用户，需要post
                    let userid = this.idbusernumjlid
                    this.idbusernumjlid++
                    user = [{
                      nick: list.nick,
                      num: list.num,
                      userid: list.userid,
                      djnum: '0',
                      iszhenren:list.iszhenren,
                      lashou:list.lashou,
                      id:userid
                    }]
                    // 上传到数据库
                    zhangbiandata = {
                      nick: list.nick,
                      userid: list.userid,
                      id: zhangbianid,
                      ynum: 0,
                      bnum: list.num,
                      xnum: list.num,
                      type: '首次上分'
                    }
                    this.postusernum(user[0], userid)
                  } else {
                    // 是老用户 需要修改put
                    zhangbiandata = {
                      nick: list.nick,
                      userid: list.userid,
                      id: zhangbianid,
                      ynum: user[0].num,
                      bnum: list.num,
                      xnum: parseInt(user[0].num) + parseInt(list.num),
                      type: '用户上分/领福利'
                    }
                    user[0].num = parseInt(user[0].num) + parseInt(list.num)
                    // 上传到数据库
                    this.putusernum(user[0], user[0].id)
                  }
                  // 发送上分成功通知
                  this.postuserch(JSON.parse(JSON.stringify(list)), list.id)
                  setTimeout(() => {
                    let sykyye = parseInt((parseInt(user[0].num) - parseInt(user[0].djnum)) / this.num.dzpl)
                    let resmsg = '@' + list.nick + ' 上分' + list.num + '成功' + '\n' + '账单金额：' + user[0].num + '\n' + '冻结金额：' + user[0].djnum + '\n' + '可用余额：' + (parseInt(user[0].num) - parseInt(user[0].djnum)) + '\n' + '剩余下注余额：' + sykyye
                    let rqmsg = this.chat.createTextAtMessage({
                      to: this.xuanGroupList.groupID,
                      conversationType: TencentCloudChat.TYPES.CONV_GROUP,
                      payload: {
                        text: resmsg,
                        // 'denny' 'lucy' 都是 userID，而非昵称
                        atUserList: [list.userid]
                      },
                    })
                    this.chat.sendMessage(rqmsg).then(imResponse => {
                      console.log(imResponse)
                    }).catch(err => {
                      console.log(err)
                    })
                  }, 1000)
                } else if (list.type == '回') {
                  // 这是处理回的信息
                  zhangbiandata = {
                    nick: user[0].nick,
                    userid: user[0].userid,
                    id: zhangbianid,
                    ynum: user[0].num,
                    bnum: parseInt(list.num) * -1,
                    xnum: parseInt(user[0].num) - parseInt(list.num),
                    type: '用户下分'
                  }
                  user[0].num = parseInt(user[0].num) - parseInt(list.num)
                  user[0].djnum = parseInt(user[0].djnum) - parseInt(list.num)
                  this.putusernum(user[0], user[0].id)
                  // 发送下分成功通知
                  this.postuserch(JSON.parse(JSON.stringify(list)), list.id)
                  let resmsg = '@' + list.nick + ' 回分' + list.num + '成功,请注意查收'
                  let rqmsg = this.chat.createTextAtMessage({
                    to: this.xuanGroupList.groupID,
                    conversationType: TencentCloudChat.TYPES.CONV_GROUP,
                    payload: {
                      text: resmsg,
                      // 'denny' 'lucy' 都是 userID，而非昵称
                      atUserList: [list.userid]
                    },
                  })
                  this.chat.sendMessage(rqmsg).then(imResponse => {
                    console.log(imResponse)
                  }).catch(err => {
                    console.log(err)
                  })
                }
                this.postzhangbian(JSON.parse(JSON.stringify(zhangbiandata)), zhangbianid)
                this.userch = this.userch.filter(item=>item.id!==list.id)
              }
            })
          }
          let creDate = moment(this.kakacreate_at).add(30,'day').format('YYYY-MM-DD HH:mm:ss')
          let thisDate = moment()
          if(!thisDate.diff(creDate,'second')<0){
            ElMessage({
              message: '卡密已经到期，请退出软件重新授权',
              type: 'error',
              plain: true,
            })
            this.isstart = false
            this.showcz = false
            this.chat.destroy()
            this.worker.postMessage({
              type: "stop",
            })
          }
          if (parseInt(this.jndkjDtime) >= this.num.tingcai2 && this.isstart) {
            this.isfp = false
          } else {
            this.isfp = true
          }
          if (this.isstart) {
            let faadv = this.adv.filter(item => item.fasongnum == this.jndkjDtime)
            faadv.forEach(list => {
              let resmsg = list.text
              let rqmsg = this.chat.createTextMessage({
                to: this.xuanGroupList.groupID,
                conversationType: TencentCloudChat.TYPES.CONV_GROUP,
                payload: {
                  text: resmsg,
                  // 'denny' 'lucy' 都是 userID，而非昵称
                },
              })
              this.chat.sendMessage(rqmsg).then(imResponse => {
                console.log(imResponse)
              }).catch(err => {
                console.log(err)
              })
            })
          }
          if (parseInt(this.jndkjDtime) == parseInt(this.num.tingcai1) && this.isstart) {
            // 发送开奖前信息
            let resmsg = this.num.tingcai1text
            let rqmsg = this.chat.createTextMessage({
              to: this.xuanGroupList.groupID,
              conversationType: TencentCloudChat.TYPES.CONV_GROUP,
              payload: {
                text: resmsg,
                // 'denny' 'lucy' 都是 userID，而非昵称
              },
            })
            this.chat.sendMessage(rqmsg).then(imResponse => {
              console.log(imResponse)
            }).catch(err => {
              console.log(err)
            })
          }
          if (parseInt(this.jndkjDtime) == parseInt(this.num.tingcai2) && this.isstart) {
            // 发送停止下注
            let resmsg = this.num.tingcai2text
            let rqmsg = this.chat.createTextMessage({
              to: this.xuanGroupList.groupID,
              conversationType: TencentCloudChat.TYPES.CONV_GROUP,
              payload: {
                text: resmsg,
                // 'denny' 'lucy' 都是 userID，而非昵称
              },
            })
            this.chat.sendMessage(rqmsg).then(imResponse => {
              console.log(imResponse)
            }).catch(err => {
              console.log(err)
            })
          }
          if (parseInt(this.jndkjDtime) == parseInt(this.num.tingcai3) && this.isstart && this.num.tingcai3text != '') {
            // 发送账单核对
            let resmsg = this.num.tingcai3text
            let xiazhuneir = ''
            this.usernumjl.forEach(list=>{
              let xialema  = this.xiazhu.filter(item=>item.userid == list.userid && item.issue == this.jndkjnextissue)
              if(xialema.length!=0){
                let xials = xialema.reduce((acc, cur) => parseInt(acc) + parseInt(cur.jine), 0)
                xiazhuneir = xiazhuneir + list.nick.slice(0, 2)  + '------' + xialema[0].type+xials+ '\n'
              }
            })
            if(xiazhuneir==''){
              xiazhuneir='本期无玩家下注'
            }
            xiazhuneir = xiazhuneir.trim()
            resmsg = resmsg.replace('{期号}', this.jndkjnextissue)
            resmsg = resmsg.replace('{内容核对}', xiazhuneir)
            let rqmsg = this.chat.createTextMessage({
              to: this.xuanGroupList.groupID,
              conversationType: TencentCloudChat.TYPES.CONV_GROUP,
              payload: {
                text: resmsg,
                // 'denny' 'lucy' 都是 userID，而非昵称
              },
            })
            this.chat.sendMessage(rqmsg).then(imResponse => {
              console.log(imResponse)
            }).catch(err => {
              console.log(err)
            })
          }
          if (parseInt(this.jndkjDtime) == 0 && this.isstart) {
            // 发送开奖中信息
            let resmsg = this.num.kaij1text
            let rqmsg = this.chat.createTextMessage({
              to: this.xuanGroupList.groupID,
              conversationType: TencentCloudChat.TYPES.CONV_GROUP,
              payload: {
                text: resmsg,
                // 'denny' 'lucy' 都是 userID，而非昵称
              },
            })
            this.chat.sendMessage(rqmsg).then(imResponse => {
              console.log(imResponse)
            }).catch(err => {
              console.log(err)
            })
          }
          if (parseInt(this.jndkjDtime) <= 0 && parseInt(this.jndkjDtime) % 5 == 0) {
            this.getjndkj()
          }
        }
      }
    },
    onKjy() {
      let issue = this.zhuangnum
      let kjtext = this.kjnum.split(",")
      let datey = moment().format('YYYY-MM-DD hh:mm:ss')
      let c4 = parseInt(kjtext[0]) + parseInt(kjtext[1]) + parseInt(kjtext[2])
      let LotResultNo = kjtext[0] + ' + ' + kjtext[1] + ' + ' + kjtext[2] + ' = ' + c4
      let c1 = this.getjndniuniuc1(parseInt(kjtext[0]), parseInt(kjtext[1]))
      let c2 = this.getjndniuniuc2(parseInt(kjtext[1]), parseInt(kjtext[2]))
      let sy = this.getjndniuniusy(c1, c2)
      let data = {
        CreatTime: datey,
        LotNumber: issue,
        LotResultNo: LotResultNo,
        c1: c1,
        c2: c2,
        sy: sy,
      }
      this.onKj(0, data)
    },
    async exportTableToImage() {
      const table = document.querySelector('.jndkj1');
      const clone = table.cloneNode(true); // deep clone of the element including its children
      clone.style.display = 'block'; // 或者根据需要设置其他样式使其可见
      clone.style.position = 'fixed'; // 可以设置为绝对定位，避免影响页面布局
      clone.style.left = '-9999px'; // 移出可视区域
      document.body.appendChild(clone)
      html2canvas(clone, { scale: 2, width: 450 }).then(canvas => {
        // 使用 canvas 做一些事情，比如转换为图片
        const img = canvas.toDataURL('image/png');
        // 然后可以将 img 插入到 DOM 中或进行其他处理
        this.imgfileurl = img
        let blob = this.dataURLtoBlob(img);
        let fileName = 'kjdata.png';
        this.file = this.blobToFile(blob, fileName);
        if (this.chat != null && this.isstart) {
          let message = this.chat.createImageMessage({
            to: this.xuanGroupList.groupID,
            conversationType: TencentCloudChat.TYPES.CONV_GROUP,
            // 消息优先级，用于群聊
            // priority: TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL,
            payload: {
              file: this.file
            },
            // 消息自定义数据（云端保存，会发送到对端，程序卸载重装后还能拉取到）
            onProgress: function (event) { console.log('file uploading:', event) }
          });
          let promise = this.chat.sendMessage(message);
          promise.then(function (imResponse) {
            // 发送成功
            console.log(imResponse);
          }).catch(function (imError) {
            // 发送失败
            console.warn('sendMessage error:', imError);
          });
        }
        document.body.removeChild(clone);
      })
    },
    //1,先将base64转换为blob
    dataURLtoBlob(dataurl) {
      let arr = dataurl.split(','),
        mime = arr[0].match(/:(.*?);/)[1],
        bstr = atob(arr[1]),
        n = bstr.length,
        u8arr = new Uint8Array(n);
      while (n--) {
        u8arr[n] = bstr.charCodeAt(n);
      }
      return new Blob([u8arr], { type: mime });
    },
    //2,再将blob转换为file
    blobToFile(theBlob, fileName) {
      theBlob.lastModifiedDate = new Date();  // 文件最后的修改日期
      theBlob.name = fileName;                // 文件名
      return new File([theBlob], fileName, { type: theBlob.type, lastModified: Date.now() });
    },
    syclass(text) {
      return {
        'tongsha': text == '通杀',
        'azhuy': text == 'A注赢',
        'bzhuy': text == 'B注赢'
      }
    },
    niuniu(text) {
      return {
        'niu-1': text == '对子' || text == '金牛' || text == '牛牛',
        'niu-2': text == '牛九' || text == '牛八' || text == '牛七' || text == '牛六',
        'niu-3': text == '牛五' || text == '牛四' || text == '牛三' || text == '牛二',
        'niu-4': text == '牛一'
      }
    },
    tongjizr() {
      let yesterday = moment().subtract(1, 'day').format('YYYY-MM-DD')
      this.tongjidatevalue = [yesterday, yesterday]
    },
    tongjijinri() {
      let yesterday = moment().format('YYYY-MM-DD')
      this.tongjidatevalue = [yesterday, yesterday]
    },
    shujudaochu() {
      let tabledata = []
      let filename = ''
      if (this.tabactiveName == 'tongjich') {
        let dd = {
          nick:'用户名',
          userid:'用户id',
          type:'查回类型',
          num:'查回金额',
          status:'查回状态',
          lashou:'拉手名称',
          iszhenren:'是否真人',
          id:'ID',
          sendou:'假人自动审核',
          create_at:'创建时间',
          update_at:'审核时间'
        }
        tabledata = [dd,...this.tongjiuserch]

        filename = '玩家查回记录'
      }
      if (this.tabactiveName == 'tongjicaicai') {
        let dd = {
          nick:'用户名',
          userid:'用户id',
          issue:'下注期号',
          xz:'下注内容',
          ls:'下注流水',
          kj:'开奖结果',
          c1:'A注',
          c2:'B注',
          sy:'AB输赢',
          zjls:'中奖金额',
          ynum:'中奖前积分',
          xnum:'中奖后积分',
          id:'ID',
          create_at:'创建时间',
          update_at:'修改时间'
        }
        tabledata = [dd,...this.tongjiuserzhongjiang]
        filename = '玩家猜猜记录'
      }
      if (this.tabactiveName == 'tongjihuishui') {
        let dd = {
          userid:'用户id',
          nick:'用户名',
          yk:'盈亏',
          issuenum:'下注期数',
          ls:'下注流水',
          zzfs:'自助反水',
          sdfs:'手动反水',
          syfs:'剩余反水',
          fulif:'查福利分',
          sjyk:'实际盈亏',
          zfs:'总需反水',
        }
        tabledata = [dd,...this.tongjihuishuijisuan]
        filename = '玩家回水计算'
      }
      if (this.tabactiveName == 'tongjifenshu') {
        let dd = {
          LotNumber:'期号',
          LotResultNo:'开奖结果',
          c1:'A注',
          c2:'B注',
          sy:'AB结果',
          zyl:'真人盈亏',
          jyl:'假人盈亏',
          id:'ID',
          type:'开奖类型',
          create_at:'创建时间',
          update_at:'修改时间'
        }
        tabledata = [dd,...this.tongjizhuang]
        filename = '分数统计'
      }
      if (this.tabactiveName == 'tongjifanshui') {
        let dd = {
          id:'ID',
          userid:'用户id',
          nick:'用户昵称',
          type:'反水类型',
          fs:'反水金额',
          create_at:'创建时间',
          update_at:'修改时间'
        }
        tabledata = [dd,...this.tongjiuserfs]
        filename = '反水记录'
      }
      if (this.tabactiveName == 'tongjizhangbian') {
        let dd = {
          nick:'用户昵称',
          userid:'用户id',
          id:'ID',
          ynum:'原积分',
          bnum:'变化积分',
          xnum:'现积分',
          type:'账变类型',
          create_at:'创建时间',
          update_at:'修改时间'
        }
        tabledata = [dd,...this.tongjizhangbian]
        filename = '玩家账变记录'
      }
      if (this.tabactiveName == 'caozuojl') {
        let dd = {
          id:'ID',
          infodate:'操作时间',
          conter:'操作内容',
          create_at:'创建时间',
          update_at:'修改时间'
        }
        tabledata = [dd,...this.tongjicaozuo]
        filename = '操作记录'
      }
      let  timestamp = new Date().getTime();
      filename = filename+timestamp+'.xlsx'
      const ws = XLSX.utils.json_to_sheet(tabledata);
      const wb = XLSX.utils.book_new();
      XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
      /* generate file and send to client */
      XLSX.writeFile(wb, filename);
    },
    async qingchushuju() {
      let newday = moment().subtract(31, 'day').format('YYYY-MM-DD')
      let tongjiuserch = this.userchjl.filter(item => {
        return !moment(item.create_at).isAfter(newday, 'day')
      })
      tongjiuserch.forEach(list => {
        this.deleteItem('userch', list.id)
      })

      let tongjiuserzhongjiang = this.userxiazhujl.filter(item => {
        return !moment(item.create_at).isAfter(newday, 'day')
      })
      tongjiuserzhongjiang.forEach(list => {
        this.deleteItem('zhongjiang', list.id)
      })

      let tongjiuserfs = this.cachexiazhu.filter(item => {
        return !moment(item.create_at).isAfter(newday, 'day')
      })
      tongjiuserfs.forEach(list => {
        this.deleteItem('cachexiazhu', list.id)
      })
      let tongjizhuang = this.lskaijiang.filter(item => {
        return !moment(item.create_at).isAfter(newday, 'day')
      })
      tongjizhuang.forEach(list => {
        this.deleteItem('kaijshezhi', list.id)
      })
      let tongjizhangbian = this.zhangbianjl.filter(item => {
        return !moment(item.create_at).isAfter(newday, 'day')
      })
      tongjizhangbian.forEach(list => {
        this.deleteItem('zhangbian', list.id)
      })
      this.getuserchAll()
      this.getfs()
      this.getzhangbian()
      this.getuserxiazhujlAll()
      this.getlskj()

      ElMessage({
        message: '清除数据完成',
        type: 'success',
        plain: true,
      })
    },
    async chakancaozuo(){
      this.tongjicaozuo = []
      let startDate = this.caozuojldate
      let endDate = this.caozuojldate
      this.tongjicaozuo = this.admininfo.filter(item => {
        return moment(item.infodate).isBetween(startDate, endDate, 'day', '[]')
      })
    },
   async tongjiall() {
      this.jinrijingcairenshu = 0
      this.yingzongrenshu = 0
      this.yingzongfenshu = 0
      this.shuzongrenshu = 0
      this.shuzongfenshu = 0
      this.jinrijingcaifenshu = 0
      this.jinrijingcaizongyk = 0
      this.zizhufanshuirenshu = 0
      this.fulizongfenshu = 0
      this.shijiyingkui = 0
      this.tongjichsyfen= 0
      this.tongjihuishuijisuan = []
      let startDate = moment(this.tongjidatevalue[0]).format('YYYY-MM-DD')
      let endDate = moment(this.tongjidatevalue[1]).format('YYYY-MM-DD')
      this.tongjiuserch = this.userchjl.filter(item => {
        return moment(item.create_at).isBetween(startDate, endDate, 'day', '[]')
      })
      this.tongjiuserzhongjiang = this.userxiazhujl.filter(item => {
        return moment(item.create_at).isBetween(startDate, endDate, 'day', '[]')
      })
      this.tongjiuserfs = this.cachexiazhu.filter(item => {
        return moment(item.create_at).isBetween(startDate, endDate, 'day', '[]')
      })
      this.tongjizhuang = this.lskaijiang.filter(item => {
        return moment(item.create_at).isBetween(startDate, endDate, 'day', '[]')
      })
      this.tongjizhangbian = this.zhangbianjl.filter(item => {
        return moment(item.create_at).isBetween(startDate, endDate, 'day', '[]')
      })
      if (this.tongjiuserid != '') {
        let user =  this.usernumjl.filter(list=>list.nick == this.tongjiuserid)
        let userID = ''
        if(user.length != 0){
          userID = user[0].userid
        }else{
          userID=''
        }
        this.tongjizhangbian = this.tongjizhangbian.filter(item => item.userid == userID)
        this.tongjiuserfs = this.tongjiuserfs.filter(item => item.userid == userID)
        this.tongjiuserzhongjiang = this.tongjiuserzhongjiang.filter(item => item.userid == userID)
        this.tongjiuserch = this.tongjiuserch.filter(item => item.userid == userID)
      }else{
        this.tongjizhangbian = this.tongjizhangbian.filter(item => {
          let user  = this.usernumjl.filter(list=>list.userid == item.userid)
          if(user.length!=0){
            if(user[0].iszhenren == this.radiozhenren){
              return true
            }else{
              return false
            }
          }
        })
        this.tongjiuserfs = this.tongjiuserfs.filter(item => {
          let user =  this.usernumjl.filter(list=>list.userid == item.userid)
          if(user.length!=0){
            if(user[0].iszhenren == this.radiozhenren){
              return true
            }else{
              return false
            }
          }
        })
        this.tongjiuserzhongjiang = this.tongjiuserzhongjiang.filter(item => {
          let user =  this.usernumjl.filter(list=>list.userid == item.userid)
          if(user.length!=0){
            if(user[0].iszhenren == this.radiozhenren){
              return true
            }else{
              return false
            }
          }
        })
        this.tongjiuserch = this.tongjiuserch.filter(item => {
          let user =  this.usernumjl.filter(list=>list.userid == item.userid)
          if(user.length!=0){
            if(user[0].iszhenren == this.radiozhenren){
              return true
            }else{
              return false
            }
          }
        })
        
      }
      this.usernumjl.forEach(list=>{
          let djdj = this.tongjiuserch.filter(item=>item.userid === list.userid)
          if(djdj.length!=0){
            this.tongjichsyfen = this.tongjichsyfen +parseInt(list.num)
          }
        })
      this.tongjichjinrishangfen = this.tongjiuserch.filter(item => item.type == '查' && item.status == '完成').reduce((acc, cur) => parseInt(acc) + parseInt(cur.num), 0)
      this.tongjichjinrihuifen = this.tongjiuserch.filter(item => item.type == '回' && item.status == '完成').reduce((acc, cur) => parseInt(acc) + parseInt(cur.num), 0)
      this.tongjichjinrifuli = this.tongjiuserch.filter(item => item.type == '福利' && item.status == '完成').reduce((acc, cur) => parseInt(acc) + parseInt(cur.num), 0)
      this.usernumjl.forEach(list => {
        let userjingcai = this.tongjiuserzhongjiang.filter(item => item.nick == list.nick)
        if (userjingcai.length != 0) {
          this.jinrijingcairenshu++
          let ls = userjingcai.reduce((acc, cur) => parseInt(acc) + parseInt(cur.ls), 0)
          this.jinrijingcaifenshu = this.jinrijingcaifenshu + userjingcai.reduce((acc, cur) => parseInt(acc) + parseInt(cur.ls), 0)
          let yk = userjingcai.reduce((acc, cur) => parseInt(acc) + parseInt(cur.zjls), 0)
          let zzfs = this.tongjiuserfs.filter(item => item.nick == list.nick && item.type == '自助反水').reduce((acc, cur) => parseInt(acc) + parseInt(cur.fs), 0)
          let sdfs = this.tongjiuserfs.filter(item => item.nick == list.nick && item.type == '手动反水').reduce((acc, cur) => parseInt(acc) + parseInt(cur.fs), 0)
          let zongfs = parseInt(ls * (5 / 100))
          let fulifenshu = this.tongjiuserch.filter(item => item.nick == list.nick && item.type == '福利').reduce((acc, cur) => parseInt(acc) + parseInt(cur.num), 0)
          this.fulizongfenshu = this.fulizongfenshu + fulifenshu
          let sjyk = yk + zzfs + sdfs + fulifenshu
          if (yk >= 0) {
            this.yingzongrenshu++
            this.yingzongfenshu = this.yingzongfenshu + yk

          } else {
            this.shuzongrenshu++
            this.shuzongfenshu = this.shuzongfenshu + Math.abs(yk)
          }
          if (zzfs > 0) {
            this.zizhufanshuirenshu++
          }
          if(ls<this.num.lsqf){
            zongfs = 0
            zzfs = 0
            sdfs = 0
          }
          this.tongjihuishuijisuan.push({
              userid: list.userid,
              nick: list.nick,
              yk: yk,
              issuenum: userjingcai.length,
              ls: ls,
              zzfs: zzfs,
              sdfs: sdfs,
              syfs: zongfs - zzfs - sdfs,
              fulif: fulifenshu,
              sjyk: sjyk,
              zfs: zongfs,
            })
        }
      })
      this.shijiyingkui = this.tongjihuishuijisuan.reduce((acc, cur) => parseInt(acc) + parseInt(cur.sjyk), 0)
      this.jinrijingcaizongyk = this.tongjihuishuijisuan.reduce((acc, cur) => parseInt(acc) + parseInt(cur.yk), 0)
    },
    async shoudongjisuanfanshui() {
      this.sdjisuanwanc = true
      let fsid = this.cachexiazhu.length == 0 ? 0 : this.cachexiazhu[this.cachexiazhu.length - 1].id + 1
      this.tongjihuishuijisuan.forEach(list => {
        let newDay = moment(this.tongjidatevalue[1]).format('YYYY-MM-DD')
        let user = this.usernumjl.filter(item => item.userid == list.userid)
        let fsdata = []
        let zhangbiandata = []
        if (user.length != 0) {
          if (list.syfs > 0) {
            let zhangbianid = this.idbzhangbianid
            this.idbzhangbianid++
             zhangbiandata.push( {
              nick: user[0].nick,
              userid: user[0].userid,
              id: zhangbianid,
              ynum: user[0].num,
              bnum: list.syfs,
              xnum: parseInt(user[0].num) + parseInt(list.syfs),
              type: '手动反水',
              create_at: newDay,
              update_at: newDay,
            })
            user[0].num = parseInt(user[0].num) + parseInt(list.syfs)
            // 上传服务器
             fsdata.push({
              id: fsid,
              userid: list.userid,
              nick: list.nick,
              type: '手动反水',
              fs: list.syfs,
              create_at: newDay,
              update_at: newDay,
            })
            fsid++
            this.putusernum(user[0], user[0].id)
          }
        }
        this.postzhangbian2(JSON.parse(JSON.stringify(zhangbiandata)))
        this.postfs2(JSON.parse(JSON.stringify(fsdata)))
      })
      setTimeout(()=>{
        this.sdjisuanwanc = false
        ElMessage({
            message: '处理反水完成',
            type: 'success',
            plain: true,
        })
      },1500)
    }
  },
}
</script>

<style>
#app {
  width: 100%;
  margin: 0 0;
}

.login {
  text-align: center;
}

.el-table {
  display: flex;
  flex-direction: column;
}

.el-table__body-wrapper {
  order: 1;
}

.mydemo div {
  max-height: 900px !important;
}

.bzhuy {
  font-size: 15px;
  color: #2862ff;
  font-weight: bold;
}

.azhuy {
  font-size: 15px;
  color: #ff1e1e;
  font-weight: bold;
}

.tongsha {
  font-size: 15px;
  color: #787978;
  font-weight: bold;
}

.niu-1 {
  background-color: #ff2b30;
  padding: 3px 10px 3px 10px;
  font-weight: bold;
  margin: 0 auto;
  text-align: center;
  width: 50px;
  height: 20px;
  border-radius: 0.05rem;
  color: #fff;
}

.niu-2 {
  background-color: #116de9;
  padding: 3px 10px 3px 10px;
  font-weight: bold;
  margin: 0 auto;
  text-align: center;
  width: 50px;
  height: 20px;
  border-radius: 0.05rem;
  color: #fff;
}

.niu-3 {
  background-color: #15b3bc;
  padding: 3px 10px 3px 10px;
  font-weight: bold;
  margin: 0 auto;
  text-align: center;
  width: 50px;
  height: 20px;
  border-radius: 0.05rem;
  color: #fff;
}

.niu-4 {
  background-color: #838488;
  padding: 3px 10px 3px 10px;
  font-weight: bold;
  margin: 0 auto;
  text-align: center;
  width: 50px;
  height: 20px;
  border-radius: 0.05rem;
  color: #fff;
}

.jndkj2 {
  display: block;
  position: fixed;
  left: -9999px;
}
.custom-row-class{
  color: #E6A23C !important;
}
</style>
